Skip to main content

StorageReader

Trait StorageReader 

Source
pub trait StorageReader:
    Send
    + Sync
    + Debug {
Show 59 methods // Required methods fn get_vertex( &self, space: &str, tag: &str, id: &VertexId, ) -> Result<Option<Vertex>, StorageError>; fn scan_vertices(&self, space: &str) -> Result<Vec<Vertex>, StorageError>; fn scan_vertices_by_tag( &self, space: &str, tag: &str, ) -> Result<Vec<Vertex>, StorageError>; fn scan_vertices_by_prop( &self, space: &str, tag: &str, prop: &str, value: &Value, ) -> Result<Vec<Vertex>, StorageError>; fn get_edge( &self, space: &str, src: &VertexId, dst: &VertexId, edge_type: &str, rank: i64, ) -> Result<Option<Edge>, StorageError>; fn get_node_edges( &self, space: &str, node_id: &VertexId, direction: EdgeDirection, edge_types: &[String], ) -> Result<Vec<Edge>, StorageError>; fn neighbor_dst_ids_batch( &self, space: &str, src_ids: &[VertexId], direction: EdgeDirection, edge_types: &[String], ) -> Result<Vec<Vec<VertexId>>, StorageError>; fn out_degree_batch( &self, space: &str, src_ids: &[VertexId], direction: EdgeDirection, edge_types: &[String], ) -> Result<Vec<usize>, StorageError>; fn scan_edges_by_type( &self, space: &str, edge_type: &str, ) -> Result<Vec<Edge>, StorageError>; fn scan_all_edges(&self, space: &str) -> Result<Vec<Edge>, StorageError>; fn count_vertices_by_tag( &self, space: &str, tag: &str, ) -> Result<u64, StorageError>; fn count_edges_by_type( &self, space: &str, edge_type: &str, ) -> Result<u64, StorageError>; fn lookup_index( &self, space: &str, index: &str, value: &Value, ) -> Result<Vec<Value>, StorageError>; fn get_vertex_with_schema( &self, space: &str, tag: &str, id: &Value, ) -> Result<Option<(TagInfo, Vec<u8>)>, StorageError>; fn get_edge_with_schema( &self, space: &str, edge_type: &str, src: &Value, dst: &Value, ) -> Result<Option<(EdgeTypeInfo, Vec<u8>)>, StorageError>; fn scan_vertices_with_schema( &self, space: &str, tag: &str, ) -> Result<Vec<(TagInfo, Vec<u8>)>, StorageError>; fn scan_edges_with_schema( &self, space: &str, edge_type: &str, ) -> Result<Vec<(EdgeTypeInfo, Vec<u8>)>, StorageError>; fn get_space(&self, space: &str) -> Result<Option<SpaceInfo>, StorageError>; fn get_space_by_id( &self, space_id: u64, ) -> Result<Option<SpaceInfo>, StorageError>; fn list_spaces(&self) -> Result<Vec<SpaceInfo>, StorageError>; fn get_space_id(&self, space: &str) -> Result<u64, StorageError>; fn space_exists(&self, space: &str) -> bool; fn get_tag( &self, space: &str, tag: &str, ) -> Result<Option<TagInfo>, StorageError>; fn list_tags(&self, space: &str) -> Result<Vec<TagInfo>, StorageError>; fn get_edge_type( &self, space: &str, edge_type: &str, ) -> Result<Option<EdgeTypeInfo>, StorageError>; fn list_edge_types( &self, space: &str, ) -> Result<Vec<EdgeTypeInfo>, StorageError>; fn get_tag_index( &self, space: &str, index: &str, ) -> Result<Option<Index>, StorageError>; fn list_tag_indexes(&self, space: &str) -> Result<Vec<Index>, StorageError>; fn get_edge_index( &self, space: &str, index: &str, ) -> Result<Option<Index>, StorageError>; fn list_edge_indexes(&self, space: &str) -> Result<Vec<Index>, StorageError>; fn get_vertex_version_history( &self, space: &str, tag: &str, ) -> Result<Option<LabelVersionHistory>, StorageError>; fn get_edge_version_history( &self, space: &str, edge_type: &str, ) -> Result<Option<LabelVersionHistory>, StorageError>; fn get_vertex_schema_changes( &self, space: &str, tag: &str, from_version: u64, to_version: u64, ) -> Result<Vec<PropertyChange>, StorageError>; fn get_edge_schema_changes( &self, space: &str, edge_type: &str, from_version: u64, to_version: u64, ) -> Result<Vec<PropertyChange>, StorageError>; fn detect_vertex_breaking_changes( &self, space: &str, tag: &str, from_version: u64, to_version: u64, ) -> Result<Vec<PropertyChange>, StorageError>; fn detect_edge_breaking_changes( &self, space: &str, edge_type: &str, from_version: u64, to_version: u64, ) -> Result<Vec<PropertyChange>, StorageError>; // Provided methods fn layout_version(&self) -> u64 { ... } fn vertex_id_domain(&self, space: &str) -> Option<Range<i64>> { ... } fn get_vertex_projected( &self, space: &str, tag: &str, id: &VertexId, projection: &[Arc<str>], ) -> Result<Option<Vertex>, StorageError> { ... } fn scan_vertices_by_tag_paginated( &self, space: &str, tag: &str, offset: usize, limit: usize, ) -> Result<Vec<Vertex>, StorageError> { ... } fn get_edge_projected( &self, space: &str, src: &VertexId, dst: &VertexId, edge_type: &str, rank: i64, projection: &[Arc<str>], ) -> Result<Option<Edge>, StorageError> { ... } fn get_node_edges_projected( &self, space: &str, node_id: &VertexId, direction: EdgeDirection, edge_types: &[String], projection: Option<&[Arc<str>]>, limit: Option<usize>, ) -> Result<Vec<Edge>, StorageError> { ... } fn get_vertices_batch( &self, space: &str, tag: &str, ids: &[VertexId], ) -> Result<Vec<Option<Vertex>>, StorageError> { ... } fn get_vertices_projected_batch( &self, space: &str, tag: &str, ids: &[VertexId], projection: &[Arc<str>], ) -> Result<Vec<Option<Vertex>>, StorageError> { ... } fn edge_types_ttl_active( &self, space: &str, edge_types: &[String], ) -> Result<bool, StorageError> { ... } fn scan_edges_by_type_parallel( &self, space: &str, edge_type: &str, shards: usize, ) -> Result<Vec<Edge>, StorageError> { ... } fn scan_edges_by_type_paginated( &self, space: &str, edge_type: &str, offset: usize, limit: usize, ) -> Result<Vec<Edge>, StorageError> { ... } fn enable_edge_property_index( &self, space: &str, edge_type: &str, pool_capacity: u64, ) -> Result<bool, StorageError> { ... } fn has_edge_property_index( &self, space: &str, edge_type: &str, ) -> Result<bool, StorageError> { ... } fn disable_edge_property_index( &self, space: &str, edge_type: &str, ) -> Result<(), StorageError> { ... } fn lookup_edges_by_property_range( &self, space: &str, edge_type: &str, prop_name: &str, lower: Option<&Value>, upper: Option<&Value>, include_lower: bool, include_upper: bool, ) -> Result<Vec<Edge>, StorageError> { ... } fn resolve_edge_type_name( &self, space: &str, hash: u32, ) -> Result<Option<String>, StorageError> { ... } fn create_vertex_cursor( &self, _space: &str, _options: &ScanOptions, ) -> Result<Box<dyn VertexCursor>, StorageError> { ... } fn create_edge_cursor( &self, _space: &str, _options: &ScanOptions, ) -> Result<Box<dyn EdgeCursor>, StorageError> { ... } fn create_index_cursor( &self, _plan: &IndexScanPlan, ) -> Result<Box<dyn IndexCursor<Row = IndexRow>>, StorageError> { ... } fn list_migration_history( &self, _space: &str, _label: &str, _is_edge: bool, ) -> Result<Vec<MigrationHistoryRecord>, StorageError> { ... } fn get_applied_versions( &self, _space: &str, _label: &str, _is_edge: bool, ) -> Result<Vec<u64>, StorageError> { ... } fn record_migration_history( &self, _record: MigrationHistoryRecord, ) -> Result<(), StorageError> { ... } fn list_all_migration_history( &self, ) -> Result<Vec<MigrationHistoryRecord>, StorageError> { ... }
}
Expand description

Read-only data and schema operations.

Required Methods§

Source

fn get_vertex( &self, space: &str, tag: &str, id: &VertexId, ) -> Result<Option<Vertex>, StorageError>

Source

fn scan_vertices(&self, space: &str) -> Result<Vec<Vertex>, StorageError>

Source

fn scan_vertices_by_tag( &self, space: &str, tag: &str, ) -> Result<Vec<Vertex>, StorageError>

Source

fn scan_vertices_by_prop( &self, space: &str, tag: &str, prop: &str, value: &Value, ) -> Result<Vec<Vertex>, StorageError>

Source

fn get_edge( &self, space: &str, src: &VertexId, dst: &VertexId, edge_type: &str, rank: i64, ) -> Result<Option<Edge>, StorageError>

Source

fn get_node_edges( &self, space: &str, node_id: &VertexId, direction: EdgeDirection, edge_types: &[String], ) -> Result<Vec<Edge>, StorageError>

Source

fn neighbor_dst_ids_batch( &self, space: &str, src_ids: &[VertexId], direction: EdgeDirection, edge_types: &[String], ) -> Result<Vec<Vec<VertexId>>, StorageError>

Lightweight batch neighbor read used by de-materialized expand hops (id_only/count_only). Resolves the edge-type schema once for the batch and reads MVCC neighbors directly from the CSR, skipping EdgeRecord materialization and per-edge property decoding.

Returns the external neighbor VertexIds per input source id, in input order.

Source

fn out_degree_batch( &self, space: &str, src_ids: &[VertexId], direction: EdgeDirection, edge_types: &[String], ) -> Result<Vec<usize>, StorageError>

Batch out-degree read for count-only expand tails. Counts distinct edges per source id, in input order.

Source

fn scan_edges_by_type( &self, space: &str, edge_type: &str, ) -> Result<Vec<Edge>, StorageError>

Source

fn scan_all_edges(&self, space: &str) -> Result<Vec<Edge>, StorageError>

Source

fn count_vertices_by_tag( &self, space: &str, tag: &str, ) -> Result<u64, StorageError>

Source

fn count_edges_by_type( &self, space: &str, edge_type: &str, ) -> Result<u64, StorageError>

Source

fn lookup_index( &self, space: &str, index: &str, value: &Value, ) -> Result<Vec<Value>, StorageError>

Source

fn get_vertex_with_schema( &self, space: &str, tag: &str, id: &Value, ) -> Result<Option<(TagInfo, Vec<u8>)>, StorageError>

Source

fn get_edge_with_schema( &self, space: &str, edge_type: &str, src: &Value, dst: &Value, ) -> Result<Option<(EdgeTypeInfo, Vec<u8>)>, StorageError>

Source

fn scan_vertices_with_schema( &self, space: &str, tag: &str, ) -> Result<Vec<(TagInfo, Vec<u8>)>, StorageError>

Source

fn scan_edges_with_schema( &self, space: &str, edge_type: &str, ) -> Result<Vec<(EdgeTypeInfo, Vec<u8>)>, StorageError>

Source

fn get_space(&self, space: &str) -> Result<Option<SpaceInfo>, StorageError>

Source

fn get_space_by_id( &self, space_id: u64, ) -> Result<Option<SpaceInfo>, StorageError>

Source

fn list_spaces(&self) -> Result<Vec<SpaceInfo>, StorageError>

Source

fn get_space_id(&self, space: &str) -> Result<u64, StorageError>

Source

fn space_exists(&self, space: &str) -> bool

Source

fn get_tag( &self, space: &str, tag: &str, ) -> Result<Option<TagInfo>, StorageError>

Source

fn list_tags(&self, space: &str) -> Result<Vec<TagInfo>, StorageError>

Source

fn get_edge_type( &self, space: &str, edge_type: &str, ) -> Result<Option<EdgeTypeInfo>, StorageError>

Source

fn list_edge_types( &self, space: &str, ) -> Result<Vec<EdgeTypeInfo>, StorageError>

Source

fn get_tag_index( &self, space: &str, index: &str, ) -> Result<Option<Index>, StorageError>

Source

fn list_tag_indexes(&self, space: &str) -> Result<Vec<Index>, StorageError>

Source

fn get_edge_index( &self, space: &str, index: &str, ) -> Result<Option<Index>, StorageError>

Source

fn list_edge_indexes(&self, space: &str) -> Result<Vec<Index>, StorageError>

Source

fn get_vertex_version_history( &self, space: &str, tag: &str, ) -> Result<Option<LabelVersionHistory>, StorageError>

Schema version history queries Query version history for a specific vertex tag

Source

fn get_edge_version_history( &self, space: &str, edge_type: &str, ) -> Result<Option<LabelVersionHistory>, StorageError>

Query version history for a specific edge type

Source

fn get_vertex_schema_changes( &self, space: &str, tag: &str, from_version: u64, to_version: u64, ) -> Result<Vec<PropertyChange>, StorageError>

Get schema changes between two versions for a vertex tag

Source

fn get_edge_schema_changes( &self, space: &str, edge_type: &str, from_version: u64, to_version: u64, ) -> Result<Vec<PropertyChange>, StorageError>

Get schema changes between two versions for an edge type

Source

fn detect_vertex_breaking_changes( &self, space: &str, tag: &str, from_version: u64, to_version: u64, ) -> Result<Vec<PropertyChange>, StorageError>

Detect breaking changes between versions for a vertex tag

Source

fn detect_edge_breaking_changes( &self, space: &str, edge_type: &str, from_version: u64, to_version: u64, ) -> Result<Vec<PropertyChange>, StorageError>

Detect breaking changes between versions for an edge type

Provided Methods§

Source

fn layout_version(&self) -> u64

Monotonic physical layout version of the vertex/edge layout.

Bumped on compaction, restore, and remap. 0 means the implementation does not track a layout version (default) — consumers then cannot use it to invalidate cached plans.

Source

fn vertex_id_domain(&self, space: &str) -> Option<Range<i64>>

Self-proven vertex-id domain covering a whole space.

Returns Some(min..max) only when the storage can prove that every vertex id written to the space is a non-negative i64 within that range. None means no proof exists (mixed or string ids, or no writes) and partition planning must not guess a range.

Source

fn get_vertex_projected( &self, space: &str, tag: &str, id: &VertexId, projection: &[Arc<str>], ) -> Result<Option<Vertex>, StorageError>

Fetch a vertex with only the requested properties.

The default implementation calls [get_vertex] and filters the property map. Storage engines that natively support column projection should override this to avoid reading unneeded columns.

Source

fn scan_vertices_by_tag_paginated( &self, space: &str, tag: &str, offset: usize, limit: usize, ) -> Result<Vec<Vertex>, StorageError>

Source

fn get_edge_projected( &self, space: &str, src: &VertexId, dst: &VertexId, edge_type: &str, rank: i64, projection: &[Arc<str>], ) -> Result<Option<Edge>, StorageError>

Fetch an edge with only the requested properties.

The default implementation calls [get_edge] and filters the property map. Storage engines that natively support column projection should override this to avoid decoding unneeded columns.

Source

fn get_node_edges_projected( &self, space: &str, node_id: &VertexId, direction: EdgeDirection, edge_types: &[String], projection: Option<&[Arc<str>]>, limit: Option<usize>, ) -> Result<Vec<Edge>, StorageError>

Filtered and projected per-node edge fanout.

edge_types is pushed to storage: empty means all types, otherwise only matching tables are visited. projection trims decoded columns (None means all columns, Some(&[]) means topology only). limit caps emitted edges per direction branch. The default implementation filters and trims in memory for adapters; the native engine overrides with CSR-level pushdown.

Source

fn get_vertices_batch( &self, space: &str, tag: &str, ids: &[VertexId], ) -> Result<Vec<Option<Vertex>>, StorageError>

Batch vertex point lookups with the schema resolved once.

Returns one entry per input id in input order. The default implementation loops over get_vertex for adapters; the native engine overrides with a single-timestamp batched path.

Source

fn get_vertices_projected_batch( &self, space: &str, tag: &str, ids: &[VertexId], projection: &[Arc<str>], ) -> Result<Vec<Option<Vertex>>, StorageError>

Batch vertex lookups decoding only the requested properties.

Same ordering, timestamp and visibility semantics as get_vertices_batch: one entry per input id in input order, None for missing vertices. An empty projection reads the full vertex, matching get_vertex_projected. The default implementation loops over get_vertex_projected for adapters; the native engine overrides with a single-timestamp batched path. Query expand hops use this for destination bypass columns so a property projection never pays full-attribute decoding per chunk.

Source

fn edge_types_ttl_active( &self, space: &str, edge_types: &[String], ) -> Result<bool, StorageError>

Whether any edge type reached by a topology fast path has TTL configured.

Fast paths that read raw CSR adjacency (neighbor_dst_ids_batch, out_degree_batch, multi-hop intermediate hops, GetNeighbors source) never materialize edge properties, so they cannot evaluate TTL. Before taking such a path a caller checks this predicate and, when it is true, degrades to the materializing path so results match the “expired means absent” contract.

edge_types empty means “every edge type in the space”. Returns true when at least one of the relevant edge types has a valid TTL.

Source

fn scan_edges_by_type_parallel( &self, space: &str, edge_type: &str, shards: usize, ) -> Result<Vec<Edge>, StorageError>

Table-sharded parallel variant of Self::scan_edges_by_type: the type’s edge tables fan out across shards rayon shards sharing one read timestamp, concatenated in key order. Single-table types fall back to the serial scan internally. The default body is the serial scan, so adapters and test doubles inherit it unchanged.

Source

fn scan_edges_by_type_paginated( &self, space: &str, edge_type: &str, offset: usize, limit: usize, ) -> Result<Vec<Edge>, StorageError>

Scan edges of a specific type with pagination support. Returns at most limit edges starting from offset. The offset parameter is 0-based. The limit parameter controls the page size.

Source

fn enable_edge_property_index( &self, space: &str, edge_type: &str, pool_capacity: u64, ) -> Result<bool, StorageError>

Enable the per-table edge property index for edge_type, building it from existing edge data. Returns true if the index was enabled.

Source

fn has_edge_property_index( &self, space: &str, edge_type: &str, ) -> Result<bool, StorageError>

Whether the per-table edge property index is enabled for edge_type.

Source

fn disable_edge_property_index( &self, space: &str, edge_type: &str, ) -> Result<(), StorageError>

Drop the per-table edge property index for edge_type.

Source

fn lookup_edges_by_property_range( &self, space: &str, edge_type: &str, prop_name: &str, lower: Option<&Value>, upper: Option<&Value>, include_lower: bool, include_upper: bool, ) -> Result<Vec<Edge>, StorageError>

Look up edges of edge_type whose prop_name value falls within [lower, upper) using the per-table edge property index.

Bounds are Value-typed; the storage layer encodes them with the ordered codec and applies the inclusion flags. Unbounded side = None.

Source

fn resolve_edge_type_name( &self, space: &str, hash: u32, ) -> Result<Option<String>, StorageError>

Resolve an edge type name from the storage-level edge type hash.

Edge index rows carry the edge type as a truncated FNV-1a hash of the type name (see edge_entity_ref in index/helpers.rs). This default implementation enumerates the space’s edge types and matches the hash using the same shared FNV-1a implementation as the index write path so the two sides stay consistent.

Source

fn create_vertex_cursor( &self, _space: &str, _options: &ScanOptions, ) -> Result<Box<dyn VertexCursor>, StorageError>

Create a lazy vertex scan cursor.

Implementations must provide a native lazy cursor.

Source

fn create_edge_cursor( &self, _space: &str, _options: &ScanOptions, ) -> Result<Box<dyn EdgeCursor>, StorageError>

Create a lazy edge scan cursor.

Implementations must provide a native lazy cursor.

Source

fn create_index_cursor( &self, _plan: &IndexScanPlan, ) -> Result<Box<dyn IndexCursor<Row = IndexRow>>, StorageError>

Create an index cursor for the given index and predicate.

The default implementation returns a capability error. Storage engines with native index cursor support should override this to return a lazy cursor.

Source

fn list_migration_history( &self, _space: &str, _label: &str, _is_edge: bool, ) -> Result<Vec<MigrationHistoryRecord>, StorageError>

Source

fn get_applied_versions( &self, _space: &str, _label: &str, _is_edge: bool, ) -> Result<Vec<u64>, StorageError>

Source

fn record_migration_history( &self, _record: MigrationHistoryRecord, ) -> Result<(), StorageError>

Source

fn list_all_migration_history( &self, ) -> Result<Vec<MigrationHistoryRecord>, StorageError>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§