use std::collections::{HashMap, HashSet};
use std::sync::Arc;
use linkrs_core::types::{EdgeId, Timestamp};
use linkrs_core::Value;
use crate::edge::property_schema::PropertySchema;
use crate::vertex::column::Column;
#[derive(Debug, Clone, Copy)]
struct RowVisibility {
create_ts: Timestamp,
delete_ts: Option<Timestamp>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum RowState {
Virgin,
Live,
Deleted,
}
impl RowVisibility {
fn state(&self) -> RowState {
if self.create_ts == linkrs_core::types::RESERVED_ZERO_TIMESTAMP && self.delete_ts.is_none()
{
RowState::Virgin
} else if self.delete_ts.is_some() {
RowState::Deleted
} else {
RowState::Live
}
}
fn is_virgin(&self) -> bool {
self.state() == RowState::Virgin
}
fn is_live(&self) -> bool {
self.state() == RowState::Live
}
}
const UNMAPPED_ROW: u32 = u32::MAX;
pub(crate) const FSST_MAX_SYMBOLS: usize = 255;
pub type ExportedRow = (Timestamp, Option<Timestamp>, Vec<(Arc<str>, Option<Value>)>);
#[derive(Debug, Clone)]
pub struct CsrWithProperties {
property_schema: Vec<PropertySchema>,
property_columns: Vec<Column>,
column_index: HashMap<Arc<str>, usize>,
prop_id_index: HashMap<i32, usize>,
visibility: Vec<RowVisibility>,
edge_map_segments: Vec<Option<Box<[u32; 1024]>>>,
edge_map_len: usize,
row_to_edge: Vec<Option<EdgeId>>,
free_list: Vec<u32>,
row_count: usize,
dirty_columns: HashSet<usize>,
next_prop_id: i32,
history_floor: Timestamp,
inline: bool,
}
pub(crate) mod encoding;
pub(crate) mod maintenance;
pub(crate) mod mapping;
pub(crate) mod persistence;
pub(crate) mod read;
pub(crate) mod schema;
pub(crate) mod transfer;
pub(crate) mod visibility;
pub(crate) mod write;
#[cfg(test)]
mod tests;