graphos_adapters/storage/
memory.rs1use graphos_core::graph::lpg::LpgStore;
4use std::sync::Arc;
5
6pub struct MemoryBackend {
11 store: Arc<LpgStore>,
13}
14
15impl MemoryBackend {
16 #[must_use]
18 pub fn new() -> Self {
19 Self {
20 store: Arc::new(LpgStore::new()),
21 }
22 }
23
24 #[must_use]
26 pub fn store(&self) -> &Arc<LpgStore> {
27 &self.store
28 }
29}
30
31impl Default for MemoryBackend {
32 fn default() -> Self {
33 Self::new()
34 }
35}
36
37#[cfg(test)]
38mod tests {
39 use super::*;
40
41 #[test]
42 fn test_memory_backend() {
43 let backend = MemoryBackend::new();
44 let store = backend.store();
45
46 let id = store.create_node(&["Test"]);
47 assert!(id.is_valid());
48 }
49}