linkrs-storage 0.1.0

Storage engine with CSR and memory-mapped containers
Documentation
use crate::edge::EdgeStrategy;
use crate::types::StoragePropertyDef;
use linkrs_core::types::{LabelId, Timestamp, VertexId};
use linkrs_core::Value;

/// Parameters for creating an edge type
pub struct CreateEdgeTypeParams<'a> {
    pub name: &'a str,      // Storage name (space_id:edge:user_name)
    pub user_name: &'a str, // User-visible name (e.g., KNOWS)
    pub src_label: LabelId,
    pub dst_label: LabelId,
    pub properties: Vec<StoragePropertyDef>,
    pub oe_strategy: EdgeStrategy,
    pub ie_strategy: EdgeStrategy,
}

/// Parameters for edge operations.
pub struct EdgeOperationParams {
    pub edge_label: LabelId,
    pub src_label: LabelId,
    pub src_id: VertexId,
    pub dst_label: LabelId,
    pub dst_id: VertexId,
    pub rank: i64,
}

/// Parameters for insert_edge operation.
pub struct InsertEdgeParams<'a> {
    pub edge_label: LabelId,
    pub src_label: LabelId,
    pub src_id: VertexId,
    pub dst_label: LabelId,
    pub dst_id: VertexId,
    pub rank: i64,
    pub properties: &'a [(std::sync::Arc<str>, Value)],
    pub ts: Timestamp,
}

/// One edge inside a batch insert: endpoints plus payload.
pub struct BatchEdgeInsert<'a> {
    pub src_id: VertexId,
    pub dst_id: VertexId,
    pub rank: i64,
    pub properties: &'a [(std::sync::Arc<str>, Value)],
}

/// Parameters for a batch insert into one edge type.
///
/// All edges share the edge label, endpoint labels and timestamp. Endpoint
/// labels follow the single-insert convention: zero means resolve per edge.
pub struct InsertEdgesBatchParams<'a> {
    pub edge_label: LabelId,
    pub src_label: LabelId,
    pub dst_label: LabelId,
    pub edges: &'a [BatchEdgeInsert<'a>],
    pub ts: Timestamp,
}

/// One edge key inside a batch delete: endpoints plus rank.
pub struct BatchEdgeDelete {
    pub src_id: VertexId,
    pub dst_id: VertexId,
    pub rank: i64,
}

/// Parameters for a batch delete from one edge type.
///
/// All keys share the edge label, endpoint labels and timestamp. Endpoint
/// labels follow the single-delete convention: zero means resolve per key.
/// Keys never created delete nothing and consume no tombstone, mirroring
/// the single-delete no-op; re-deleting an already-deleted edge fails the
/// batch like the single path.
pub struct DeleteEdgesBatchParams<'a> {
    pub edge_label: LabelId,
    pub src_label: LabelId,
    pub dst_label: LabelId,
    pub edges: &'a [BatchEdgeDelete],
    pub ts: Timestamp,
}