pub trait GraphWriter {
Show 21 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,
_properties: &[String],
) -> Result<()> { ... }
fn drop_property_index(
&self,
_label: &str,
_properties: &[String],
) -> Result<()> { ... }
fn list_property_indexes(&self) -> Result<Vec<(String, Vec<String>)>> { ... }
fn create_edge_property_index(
&self,
_edge_type: &str,
_properties: &[String],
) -> Result<()> { ... }
fn drop_edge_property_index(
&self,
_edge_type: &str,
_properties: &[String],
) -> Result<()> { ... }
fn list_edge_property_indexes(&self) -> Result<Vec<(String, Vec<String>)>> { ... }
fn create_point_index(&self, _label: &str, _property: &str) -> Result<()> { ... }
fn drop_point_index(&self, _label: &str, _property: &str) -> Result<()> { ... }
fn list_point_indexes(&self) -> Result<Vec<(String, String)>> { ... }
fn create_edge_point_index(
&self,
_edge_type: &str,
_property: &str,
) -> Result<()> { ... }
fn drop_edge_point_index(
&self,
_edge_type: &str,
_property: &str,
) -> Result<()> { ... }
fn list_edge_point_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>> { ... }
fn install_trigger(&self, _name: &str, _spec_blob: &[u8]) -> Result<()> { ... }
fn drop_trigger(&self, _name: &str) -> Result<()> { ... }
}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,
_properties: &[String],
) -> Result<()>
fn create_property_index( &self, _label: &str, _properties: &[String], ) -> Result<()>
Declare a new property index. properties is a slice so the
composite form (CREATE INDEX FOR (n:L) ON (n.a, n.b)) fits
the same surface as single-property. Default impl errors so
remote writers that don’t yet support cluster-aware DDL
surface the limitation immediately; storage-backed writers
override via the blanket impl.
Sourcefn drop_property_index(
&self,
_label: &str,
_properties: &[String],
) -> Result<()>
fn drop_property_index( &self, _label: &str, _properties: &[String], ) -> Result<()>
Tear down a property index. Mirrors Self::create_property_index.
Sourcefn list_property_indexes(&self) -> Result<Vec<(String, Vec<String>)>>
fn list_property_indexes(&self) -> Result<Vec<(String, Vec<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_edge_property_index(
&self,
_edge_type: &str,
_properties: &[String],
) -> Result<()>
fn create_edge_property_index( &self, _edge_type: &str, _properties: &[String], ) -> Result<()>
Relationship-scope analogue of
Self::create_property_index.
Sourcefn drop_edge_property_index(
&self,
_edge_type: &str,
_properties: &[String],
) -> Result<()>
fn drop_edge_property_index( &self, _edge_type: &str, _properties: &[String], ) -> Result<()>
Tear down an edge property index. Mirrors
Self::create_edge_property_index.
Sourcefn list_edge_property_indexes(&self) -> Result<Vec<(String, Vec<String>)>>
fn list_edge_property_indexes(&self) -> Result<Vec<(String, Vec<String>)>>
Snapshot the currently-registered edge property indexes as
(edge_type, property) pairs. Default impl returns an empty
list.
Sourcefn create_point_index(&self, _label: &str, _property: &str) -> Result<()>
fn create_point_index(&self, _label: &str, _property: &str) -> Result<()>
Declare a point / spatial index on (label, property).
Default impl errors — remote writers opt in via the blanket
StorageEngine impl or a cluster-aware override.
Sourcefn drop_point_index(&self, _label: &str, _property: &str) -> Result<()>
fn drop_point_index(&self, _label: &str, _property: &str) -> Result<()>
Tear down a point index. Mirrors
Self::create_point_index.
Sourcefn list_point_indexes(&self) -> Result<Vec<(String, String)>>
fn list_point_indexes(&self) -> Result<Vec<(String, String)>>
Snapshot the currently-registered point indexes as
(label, property) pairs. Default impl returns empty.
Sourcefn create_edge_point_index(
&self,
_edge_type: &str,
_property: &str,
) -> Result<()>
fn create_edge_point_index( &self, _edge_type: &str, _property: &str, ) -> Result<()>
Relationship-scope analogue of
Self::create_point_index.
Sourcefn drop_edge_point_index(&self, _edge_type: &str, _property: &str) -> Result<()>
fn drop_edge_point_index(&self, _edge_type: &str, _property: &str) -> Result<()>
Tear down an edge point index. Mirrors
Self::create_edge_point_index.
Sourcefn list_edge_point_indexes(&self) -> Result<Vec<(String, String)>>
fn list_edge_point_indexes(&self) -> Result<Vec<(String, String)>>
Snapshot the currently-registered edge point indexes as
(edge_type, property) pairs.
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.
Sourcefn install_trigger(&self, _name: &str, _spec_blob: &[u8]) -> Result<()>
fn install_trigger(&self, _name: &str, _spec_blob: &[u8]) -> Result<()>
Install (or replace) an apoc.trigger.* registration.
spec_blob is the serde-encoded trigger spec — opaque
to the writer; the storage layer just persists the
bytes. Cluster-aware writers buffer this as a
GraphCommand::InstallTrigger so the commit path
replicates it; direct-to-storage writers persist
immediately.
Sourcefn drop_trigger(&self, _name: &str) -> Result<()>
fn drop_trigger(&self, _name: &str) -> Result<()>
Drop a registered trigger by name. Idempotent — a missing name is not an error so routing-mode rollback can re-issue partially-applied DROPs.
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.