pub trait GraphWriter {
// 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_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§
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§
Sourcefn create_property_index(&self, _label: &str, _property: &str) -> Result<()>
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.
Sourcefn drop_property_index(&self, _label: &str, _property: &str) -> Result<()>
fn drop_property_index(&self, _label: &str, _property: &str) -> Result<()>
Tear down a property index. Mirrors Self::create_property_index.
Sourcefn list_property_indexes(&self) -> Result<Vec<(String, String)>>
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.
Sourcefn create_property_constraint(
&self,
_name: Option<&str>,
_scope: &ConstraintScope,
_properties: &[String],
_kind: PropertyConstraintKind,
_if_not_exists: bool,
) -> Result<PropertyConstraintSpec>
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.
Sourcefn drop_property_constraint(&self, _name: &str, _if_exists: bool) -> Result<()>
fn drop_property_constraint(&self, _name: &str, _if_exists: bool) -> Result<()>
Tear down a constraint by name. Mirrors
Self::create_property_constraint.
Sourcefn list_property_constraints(&self) -> Result<Vec<PropertyConstraintSpec>>
fn list_property_constraints(&self) -> Result<Vec<PropertyConstraintSpec>>
Snapshot the currently-registered constraints for
SHOW CONSTRAINTS. Default impl returns an empty list.
Implementors§
impl GraphWriter for StorageWriterAdapter<'_>
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.