Skip to main content

GraphWriter

Trait GraphWriter 

Source
pub trait GraphWriter {
Show 13 methods // Required methods fn put_node(&self, node: &Node) -> Result<()>; fn put_edge(&self, edge: &Edge) -> Result<()>; fn delete_edge(&self, id: EdgeId) -> Result<()>; fn detach_delete_node(&self, id: NodeId) -> Result<()>; // Provided methods fn create_property_index(&self, _label: &str, _property: &str) -> Result<()> { ... } fn drop_property_index(&self, _label: &str, _property: &str) -> Result<()> { ... } fn list_property_indexes(&self) -> Result<Vec<(String, String)>> { ... } fn create_edge_property_index( &self, _edge_type: &str, _property: &str, ) -> Result<()> { ... } fn drop_edge_property_index( &self, _edge_type: &str, _property: &str, ) -> Result<()> { ... } fn list_edge_property_indexes(&self) -> Result<Vec<(String, String)>> { ... } fn create_property_constraint( &self, _name: Option<&str>, _scope: &ConstraintScope, _properties: &[String], _kind: PropertyConstraintKind, _if_not_exists: bool, ) -> Result<PropertyConstraintSpec> { ... } fn drop_property_constraint( &self, _name: &str, _if_exists: bool, ) -> Result<()> { ... } fn list_property_constraints(&self) -> Result<Vec<PropertyConstraintSpec>> { ... }
}
Expand description

Sink for mutating graph operations produced by the executor. Isolates write-side concerns from read-side traversal so we can plug in either a direct-to-storage writer (single-node mode) or a Raft-backed writer that proposes each mutation through consensus (cluster mode).

Methods are sync because the executor’s iterator model is sync. Async-backed implementations (e.g. the Raft writer) bridge via Handle::block_on; callers must run the executor inside spawn_blocking so they don’t stall the tokio runtime.

Required Methods§

Source

fn put_node(&self, node: &Node) -> Result<()>

Source

fn put_edge(&self, edge: &Edge) -> Result<()>

Source

fn delete_edge(&self, id: EdgeId) -> Result<()>

Source

fn detach_delete_node(&self, id: NodeId) -> Result<()>

Provided Methods§

Source

fn create_property_index(&self, _label: &str, _property: &str) -> Result<()>

Declare a new property index. Default impl errors so remote writers (Raft, routing) that don’t yet support cluster-aware DDL surface the limitation immediately. Storage-backed writers override this via the blanket impl.

Source

fn drop_property_index(&self, _label: &str, _property: &str) -> Result<()>

Tear down a property index. Mirrors Self::create_property_index.

Source

fn list_property_indexes(&self) -> Result<Vec<(String, String)>>

Snapshot the currently-registered property indexes as (label, property) pairs for SHOW INDEXES. Default impl returns an empty list — remote writers will wire real fan-out in Phase C.

Source

fn create_edge_property_index( &self, _edge_type: &str, _property: &str, ) -> Result<()>

Relationship-scope analogue of Self::create_property_index. Default impl errors so remote writers that haven’t plumbed edge-index DDL yet surface the limitation immediately; storage-backed writers override via the blanket impl.

Source

fn drop_edge_property_index( &self, _edge_type: &str, _property: &str, ) -> Result<()>

Tear down an edge property index. Mirrors Self::create_edge_property_index.

Source

fn list_edge_property_indexes(&self) -> Result<Vec<(String, String)>>

Snapshot the currently-registered edge property indexes as (edge_type, property) pairs. Default impl returns an empty list.

Source

fn create_property_constraint( &self, _name: Option<&str>, _scope: &ConstraintScope, _properties: &[String], _kind: PropertyConstraintKind, _if_not_exists: bool, ) -> Result<PropertyConstraintSpec>

Declare a new property constraint. Default impl errors so remote writers that haven’t plumbed constraint DDL yet surface the limitation immediately — storage-backed writers override via the blanket impl. properties is a list to accommodate composite kinds (NodeKey); single-property kinds pass a one-element slice.

Source

fn drop_property_constraint(&self, _name: &str, _if_exists: bool) -> Result<()>

Tear down a constraint by name. Mirrors Self::create_property_constraint.

Source

fn list_property_constraints(&self) -> Result<Vec<PropertyConstraintSpec>>

Snapshot the currently-registered constraints for SHOW CONSTRAINTS. Default impl returns an empty list.

Implementors§

Source§

impl GraphWriter for StorageWriterAdapter<'_>

Source§

impl<T: StorageEngine> GraphWriter for T

Blanket impl: any sized type that implements StorageEngine is automatically a GraphWriter. See the matching crate::reader::GraphReader blanket for rationale, and StorageWriterAdapter for the trait-object adapter.