Skip to main content

graphos_adapters/storage/wal/
record.rs

1//! WAL record types.
2
3use graphos_common::types::{EdgeId, NodeId, TxId, Value};
4use serde::{Deserialize, Serialize};
5
6/// A record in the Write-Ahead Log.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub enum WalRecord {
9    /// Create a new node.
10    CreateNode {
11        /// Node ID.
12        id: NodeId,
13        /// Labels for the node.
14        labels: Vec<String>,
15    },
16
17    /// Delete a node.
18    DeleteNode {
19        /// Node ID.
20        id: NodeId,
21    },
22
23    /// Create a new edge.
24    CreateEdge {
25        /// Edge ID.
26        id: EdgeId,
27        /// Source node ID.
28        src: NodeId,
29        /// Destination node ID.
30        dst: NodeId,
31        /// Edge type.
32        edge_type: String,
33    },
34
35    /// Delete an edge.
36    DeleteEdge {
37        /// Edge ID.
38        id: EdgeId,
39    },
40
41    /// Set a property on a node.
42    SetNodeProperty {
43        /// Node ID.
44        id: NodeId,
45        /// Property key.
46        key: String,
47        /// Property value.
48        value: Value,
49    },
50
51    /// Set a property on an edge.
52    SetEdgeProperty {
53        /// Edge ID.
54        id: EdgeId,
55        /// Property key.
56        key: String,
57        /// Property value.
58        value: Value,
59    },
60
61    /// Transaction commit.
62    TxCommit {
63        /// Transaction ID.
64        tx_id: TxId,
65    },
66
67    /// Transaction abort.
68    TxAbort {
69        /// Transaction ID.
70        tx_id: TxId,
71    },
72
73    /// Checkpoint marker.
74    Checkpoint {
75        /// Transaction ID at checkpoint.
76        tx_id: TxId,
77    },
78}