pub trait GraphStoreMut: GraphStore {
Show 24 methods
// Required methods
fn create_node(&self, labels: &[&str]) -> NodeId;
fn create_node_versioned(
&self,
labels: &[&str],
epoch: EpochId,
transaction_id: TransactionId,
) -> NodeId;
fn create_edge(&self, src: NodeId, dst: NodeId, edge_type: &str) -> EdgeId;
fn create_edge_versioned(
&self,
src: NodeId,
dst: NodeId,
edge_type: &str,
epoch: EpochId,
transaction_id: TransactionId,
) -> EdgeId;
fn batch_create_edges(
&self,
edges: &[(NodeId, NodeId, &str)],
) -> Vec<EdgeId>;
fn delete_node(&self, id: NodeId) -> bool;
fn delete_node_versioned(
&self,
id: NodeId,
epoch: EpochId,
transaction_id: TransactionId,
) -> bool;
fn delete_node_edges(&self, node_id: NodeId);
fn delete_edge(&self, id: EdgeId) -> bool;
fn delete_edge_versioned(
&self,
id: EdgeId,
epoch: EpochId,
transaction_id: TransactionId,
) -> bool;
fn set_node_property(&self, id: NodeId, key: &str, value: Value);
fn set_edge_property(&self, id: EdgeId, key: &str, value: Value);
fn remove_node_property(&self, id: NodeId, key: &str) -> Option<Value>;
fn remove_edge_property(&self, id: EdgeId, key: &str) -> Option<Value>;
fn add_label(&self, node_id: NodeId, label: &str) -> bool;
fn remove_label(&self, node_id: NodeId, label: &str) -> bool;
// Provided methods
fn set_node_property_versioned(
&self,
id: NodeId,
key: &str,
value: Value,
_transaction_id: TransactionId,
) { ... }
fn set_edge_property_versioned(
&self,
id: EdgeId,
key: &str,
value: Value,
_transaction_id: TransactionId,
) { ... }
fn remove_node_property_versioned(
&self,
id: NodeId,
key: &str,
_transaction_id: TransactionId,
) -> Option<Value> { ... }
fn remove_edge_property_versioned(
&self,
id: EdgeId,
key: &str,
_transaction_id: TransactionId,
) -> Option<Value> { ... }
fn add_label_versioned(
&self,
node_id: NodeId,
label: &str,
_transaction_id: TransactionId,
) -> bool { ... }
fn remove_label_versioned(
&self,
node_id: NodeId,
label: &str,
_transaction_id: TransactionId,
) -> bool { ... }
fn create_node_with_props(
&self,
labels: &[&str],
properties: &[(PropertyKey, Value)],
) -> NodeId { ... }
fn create_edge_with_props(
&self,
src: NodeId,
dst: NodeId,
edge_type: &str,
properties: &[(PropertyKey, Value)],
) -> EdgeId { ... }
}Expand description
Write operations for graph mutation.
Separated from GraphStore so read-only wrappers (snapshots, read
replicas) can implement only GraphStore. Any mutable store is also
readable via the supertrait bound.
Required Methods§
Sourcefn create_node(&self, labels: &[&str]) -> NodeId
fn create_node(&self, labels: &[&str]) -> NodeId
Creates a new node with the given labels.
Sourcefn create_node_versioned(
&self,
labels: &[&str],
epoch: EpochId,
transaction_id: TransactionId,
) -> NodeId
fn create_node_versioned( &self, labels: &[&str], epoch: EpochId, transaction_id: TransactionId, ) -> NodeId
Creates a new node within a transaction context.
Sourcefn create_edge(&self, src: NodeId, dst: NodeId, edge_type: &str) -> EdgeId
fn create_edge(&self, src: NodeId, dst: NodeId, edge_type: &str) -> EdgeId
Creates a new edge between two nodes.
Sourcefn create_edge_versioned(
&self,
src: NodeId,
dst: NodeId,
edge_type: &str,
epoch: EpochId,
transaction_id: TransactionId,
) -> EdgeId
fn create_edge_versioned( &self, src: NodeId, dst: NodeId, edge_type: &str, epoch: EpochId, transaction_id: TransactionId, ) -> EdgeId
Creates a new edge within a transaction context.
Sourcefn batch_create_edges(&self, edges: &[(NodeId, NodeId, &str)]) -> Vec<EdgeId>
fn batch_create_edges(&self, edges: &[(NodeId, NodeId, &str)]) -> Vec<EdgeId>
Creates multiple edges in batch (single lock acquisition).
Sourcefn delete_node(&self, id: NodeId) -> bool
fn delete_node(&self, id: NodeId) -> bool
Deletes a node. Returns true if the node existed.
Sourcefn delete_node_versioned(
&self,
id: NodeId,
epoch: EpochId,
transaction_id: TransactionId,
) -> bool
fn delete_node_versioned( &self, id: NodeId, epoch: EpochId, transaction_id: TransactionId, ) -> bool
Deletes a node within a transaction context. Returns true if the node existed.
Sourcefn delete_node_edges(&self, node_id: NodeId)
fn delete_node_edges(&self, node_id: NodeId)
Deletes all edges connected to a node (DETACH DELETE).
Sourcefn delete_edge(&self, id: EdgeId) -> bool
fn delete_edge(&self, id: EdgeId) -> bool
Deletes an edge. Returns true if the edge existed.
Sourcefn delete_edge_versioned(
&self,
id: EdgeId,
epoch: EpochId,
transaction_id: TransactionId,
) -> bool
fn delete_edge_versioned( &self, id: EdgeId, epoch: EpochId, transaction_id: TransactionId, ) -> bool
Deletes an edge within a transaction context. Returns true if the edge existed.
Sourcefn set_node_property(&self, id: NodeId, key: &str, value: Value)
fn set_node_property(&self, id: NodeId, key: &str, value: Value)
Sets a property on a node.
Sourcefn set_edge_property(&self, id: EdgeId, key: &str, value: Value)
fn set_edge_property(&self, id: EdgeId, key: &str, value: Value)
Sets a property on an edge.
Sourcefn remove_node_property(&self, id: NodeId, key: &str) -> Option<Value>
fn remove_node_property(&self, id: NodeId, key: &str) -> Option<Value>
Removes a property from a node. Returns the previous value if it existed.
Sourcefn remove_edge_property(&self, id: EdgeId, key: &str) -> Option<Value>
fn remove_edge_property(&self, id: EdgeId, key: &str) -> Option<Value>
Removes a property from an edge. Returns the previous value if it existed.
Sourcefn add_label(&self, node_id: NodeId, label: &str) -> bool
fn add_label(&self, node_id: NodeId, label: &str) -> bool
Adds a label to a node. Returns true if the label was new.
Sourcefn remove_label(&self, node_id: NodeId, label: &str) -> bool
fn remove_label(&self, node_id: NodeId, label: &str) -> bool
Removes a label from a node. Returns true if the label existed.
Provided Methods§
Sourcefn set_node_property_versioned(
&self,
id: NodeId,
key: &str,
value: Value,
_transaction_id: TransactionId,
)
fn set_node_property_versioned( &self, id: NodeId, key: &str, value: Value, _transaction_id: TransactionId, )
Sets a node property within a transaction, recording the previous value so it can be restored on rollback.
Default delegates to set_node_property.
Sourcefn set_edge_property_versioned(
&self,
id: EdgeId,
key: &str,
value: Value,
_transaction_id: TransactionId,
)
fn set_edge_property_versioned( &self, id: EdgeId, key: &str, value: Value, _transaction_id: TransactionId, )
Sets an edge property within a transaction, recording the previous value so it can be restored on rollback.
Default delegates to set_edge_property.
Sourcefn remove_node_property_versioned(
&self,
id: NodeId,
key: &str,
_transaction_id: TransactionId,
) -> Option<Value>
fn remove_node_property_versioned( &self, id: NodeId, key: &str, _transaction_id: TransactionId, ) -> Option<Value>
Removes a node property within a transaction, recording the previous value so it can be restored on rollback.
Default delegates to remove_node_property.
Sourcefn remove_edge_property_versioned(
&self,
id: EdgeId,
key: &str,
_transaction_id: TransactionId,
) -> Option<Value>
fn remove_edge_property_versioned( &self, id: EdgeId, key: &str, _transaction_id: TransactionId, ) -> Option<Value>
Removes an edge property within a transaction, recording the previous value so it can be restored on rollback.
Default delegates to remove_edge_property.
Sourcefn add_label_versioned(
&self,
node_id: NodeId,
label: &str,
_transaction_id: TransactionId,
) -> bool
fn add_label_versioned( &self, node_id: NodeId, label: &str, _transaction_id: TransactionId, ) -> bool
Adds a label within a transaction, recording the change for rollback.
Default delegates to add_label.
Sourcefn remove_label_versioned(
&self,
node_id: NodeId,
label: &str,
_transaction_id: TransactionId,
) -> bool
fn remove_label_versioned( &self, node_id: NodeId, label: &str, _transaction_id: TransactionId, ) -> bool
Removes a label within a transaction, recording the change for rollback.
Default delegates to remove_label.
Sourcefn create_node_with_props(
&self,
labels: &[&str],
properties: &[(PropertyKey, Value)],
) -> NodeId
fn create_node_with_props( &self, labels: &[&str], properties: &[(PropertyKey, Value)], ) -> NodeId
Creates a new node with labels and properties in one call.
The default implementation calls create_node
followed by set_node_property for each
property. Implementations may override for atomicity or performance.
Sourcefn create_edge_with_props(
&self,
src: NodeId,
dst: NodeId,
edge_type: &str,
properties: &[(PropertyKey, Value)],
) -> EdgeId
fn create_edge_with_props( &self, src: NodeId, dst: NodeId, edge_type: &str, properties: &[(PropertyKey, Value)], ) -> EdgeId
Creates a new edge with properties in one call.
The default implementation calls create_edge
followed by set_edge_property for each
property. Implementations may override for atomicity or performance.