An implementation of an application timeline store backed by leveldb.
There are three sections of the db, the start time section, the entity section, and the indexed entity section.
The start time section is used to retrieve the unique start time for a given entity. Its values each contain a start time while its keys are of the form:
START_TIME_LOOKUP_PREFIX + entity type + entity id
The entity section is ordered by entity type, then entity start time descending, then entity ID. There are four sub-sections of the entity section: events, primary filters, related entities, and other info. The event entries have event info serialized into their values. The other info entries have values corresponding to the values of the other info name/value map for the entry (note the names are contained in the key). All other entries have empty values. The key structure is as follows:
ENTITY_ENTRY_PREFIX + entity type + revstarttime + entity id ENTITY_ENTRY_PREFIX + entity type + revstarttime + entity id + EVENTS_COLUMN + reveventtimestamp + eventtype ENTITY_ENTRY_PREFIX + entity type + revstarttime + entity id + PRIMARY_FILTERS_COLUMN + name + value ENTITY_ENTRY_PREFIX + entity type + revstarttime + entity id + OTHER_INFO_COLUMN + name ENTITY_ENTRY_PREFIX + entity type + revstarttime + entity id + RELATED_ENTITIES_COLUMN + relatedentity type + relatedentity id ENTITY_ENTRY_PREFIX + entity type + revstarttime + entity id + INVISIBLE_REVERSE_RELATED_ENTITIES_COLUMN + relatedentity type + relatedentity id
The indexed entity section contains a primary filter name and primary filter value as the prefix. Within a given name/value, entire entity entries are stored in the same format as described in the entity section above (below, "key" represents any one of the possible entity entry keys described above).
INDEXED_ENTRY_PREFIX + primaryfilter name + primaryfilter value + key
|
|