MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / open

Method open

nodedb/src/control/array_sync/snapshot_store.rs:72–84  ·  view source on GitHub ↗

Open or create the snapshot database at `{data_dir}/array_sync/snapshots.redb`.

(data_dir: &Path)

Source from the content-addressed store, hash-verified

70impl OriginSnapshotStore {
71 /// Open or create the snapshot database at `{data_dir}/array_sync/snapshots.redb`.
72 pub fn open(data_dir: &Path) -> crate::Result<Arc<Self>> {
73 let dir = data_dir.join("array_sync");
74 std::fs::create_dir_all(&dir).map_err(|e| crate::Error::Storage {
75 engine: "array_sync".into(),
76 detail: format!("create dir {}: {e}", dir.display()),
77 })?;
78 let path = dir.join("snapshots.redb");
79 let db = Database::create(&path).map_err(|e| crate::Error::Storage {
80 engine: "array_sync".into(),
81 detail: format!("open snapshots db {}: {e}", path.display()),
82 })?;
83 Self::init(db)
84 }
85
86 /// In-memory-only store for tests.
87 pub fn open_in_memory() -> crate::Result<Arc<Self>> {

Callers

nothing calls this directly

Calls 2

joinMethod · 0.80
createFunction · 0.50

Tested by

no test coverage detected