pub struct CacheColumns {
pub timestamps: Vec<i64>,
pub agents: Vec<String>,
pub event_types: Vec<EventType>,
pub item_ids: Vec<String>,
pub parents: Vec<String>,
pub itc: Vec<String>,
pub values: Vec<String>,
}Expand description
All event columns for a batch of events, decomposed by type.
Each field holds one column of data (in event order). The i-th element
of each column corresponds to the i-th event in the batch.
§Construction
Build with CacheColumns::from_events. Consume with
[CacheColumns::to_column_slices] for encoding.
Fields§
§timestamps: Vec<i64>Wall-clock timestamps in microseconds since Unix epoch.
agents: Vec<String>Agent identifier strings.
event_types: Vec<EventType>Event type discriminants.
item_ids: Vec<String>Item ID strings.
parents: Vec<String>Parent hash lists — each element is a comma-joined string of parent hashes (empty string for root events).
itc: Vec<String>ITC stamp strings.
values: Vec<String>JSON-serialised event payload strings.
Implementations§
Source§impl CacheColumns
impl CacheColumns
Sourcepub fn from_events(events: &[Event]) -> Result<Self, Error>
pub fn from_events(events: &[Event]) -> Result<Self, Error>
Decompose a slice of events into parallel columns.
§Errors
Returns an error if any event’s data fails to serialise to JSON.
Sourcepub fn into_events(self) -> Result<Vec<Event>, String>
pub fn into_events(self) -> Result<Vec<Event>, String>
Reconstruct events from parallel column data.
All columns must have the same length. Parent hashes are split on commas; the empty string yields an empty parent list (root event).
§Errors
Returns an error string if:
- Column lengths differ.
- An item ID string is not a valid
ItemId. - A value JSON string cannot be parsed as the event’s data payload.
Source§impl CacheColumns
impl CacheColumns
Sourcepub fn row(&self, index: usize) -> Option<ColumnRow>
pub fn row(&self, index: usize) -> Option<ColumnRow>
Extract a single row by index.
Returns None if index >= self.len().
Sourcepub fn event_types(&self) -> &[EventType]
pub fn event_types(&self) -> &[EventType]
Return only the event types column (useful for count-by-type queries).
Sourcepub fn timestamps(&self) -> &[i64]
pub fn timestamps(&self) -> &[i64]
Return only the timestamps column (useful for range queries).
Trait Implementations§
Source§impl Clone for CacheColumns
impl Clone for CacheColumns
Source§fn clone(&self) -> CacheColumns
fn clone(&self) -> CacheColumns
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more