Files
brahman/crates/modules/semantic_dht/minga-store/src/repo.rs
T
Sergio 53dbdf0f1d chore: monorepo inicial con arje + minga + yahweh absorbidos
Workspace en 4 ejes (core/modules/apps/shared):

- core/: 24 crates de arje (Init systemd-compatible: ente-card, ente-zero,
  ente-kernel, ente-bus, ente-cas, ente-soma, ente-wasm, ente-snapshot,
  ente-brain, ente-echo, ente-policy-provider, + 12 crates *-compat)
- modules/semantic_dht/: 5 crates de minga (minga-core con AST/CAS/MST,
  minga-p2p con libp2p Kad, minga-store, minga-vfs, minga-cli)
- modules/ui_engine/: 11 crates de yahweh (libs/{core,theme,bus,providers},
  widgets/{tree,splitter,tabs,tiled,container_core,text_input})
- apps/: 5 crates de yahweh (file_explorer, database_explorer, text_viewer,
  image_viewer, yahweh-shell)
- shared_wit/protocol.wit: handshake/lifecycle inicial

Cargo.toml unificado: thiserror bumped a 2 (transparente para arje), tokio
"full", paths intra-workspace de yahweh redirigidos a su nueva ubicación.

cargo check --workspace: 0 errores, 17 warnings (dead code preexistente).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 04:45:44 +00:00

42 lines
1.2 KiB
Rust

//! `PersistentRepo`: agrupa los tres stores (nodos, atestaciones, MST)
//! sobre una única `sled::Db`. Cada store ocupa su propio tree
//! (namespace lógico) dentro del mismo directorio en disco.
use std::path::Path;
use sled::Db;
use crate::{
attestation_store::SledAttestationStore, error::StoreError, mst_store::SledMstStore,
node_store::SledNodeStore,
};
pub struct PersistentRepo {
db: Db,
pub nodes: SledNodeStore,
pub attestations: SledAttestationStore,
pub mst: SledMstStore,
}
impl PersistentRepo {
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, StoreError> {
let db = sled::open(path)?;
let nodes = SledNodeStore::open_tree(&db, "nodes")?;
let attestations = SledAttestationStore::open_tree(&db, "attestations")?;
let mst = SledMstStore::open_tree(&db, "mst")?;
Ok(Self {
db,
nodes,
attestations,
mst,
})
}
/// Flushea los tres trees a disco. Llamar en puntos de
/// checkpoint o antes de cerrar para garantizar durabilidad.
pub fn flush(&self) -> Result<(), StoreError> {
self.db.flush()?;
Ok(())
}
}