我目前正在 Cassandra 上实现存储算法的想法, 为了让这个想法奏效, 除了每个单元格的时间戳之外,我还需要存储一些每个单元格的元数据。
我的问题是, Cassandra 在代码库中的哪个位置处理此每个单元格的时间戳? 我已经浏览了写入路径,似乎找不到它。
你可能想从这里开始:
单元格.java:
32 /**
33 * A cell is our atomic unit for a single value of a single column.
34 * <p>
35 * A cell always holds at least a timestamp that gives us how the cell reconcile. We then
36 * have 3 main types of cells:
37 * 1) live regular cells: those will also have a value and, if for a complex column, a path.
38 * 2) expiring cells: on top of regular cells, those have a ttl and a local deletion time (when they are expired).
39 * 3) tombstone cells: those won't have value, but they have a local deletion time (when the tombstone was created).
40 */
https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob;f=src/java/org/apache/cassandra/db/rows/Cell.java;h=300bbce12a225fc7630daee78d2fe64b6a868c73;hb=3b56d4df40800f76dcf2c0019af43b7dbc244c57
AbstractCell.java(继承 Cell.java(:
https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob;f=src/java/org/apache/cassandra/db/rows/AbstractCell.java;h=bfe7396c23c45a3ed8da479551c8e1a6fa23f76b;hb=3b56d4df40800f76dcf2c0019af43b7dbc244c57
和这里
NativeCell.java(继承AbstractCell.java(:
https://git-wip-us.apache.org/repos/asf?p=cassandra.git;a=blob;f=src/java/org/apache/cassandra/db/rows/NativeCell.java;h=c4cb6c1342cba700f5b059d1f5a9108bb83b2a66;hb=3b56d4df40800f76dcf2c0019af43b7dbc244c57
但是,如果要将 Cassandra 用于存储解决方案,请显式存储时间戳和元数据,并且不要使用 cassandras 内部的单元格元数据。