Single-commit clean baseline after security scrub of niche-tells, project codenames, internal jargon, and contributor-email leaks. Contents: - 100 Rust crates (_primitives/_rust/) - 37 agent manifests (_manifests/) + generated specs (_generated/) - 67 user-invocable skills (skills/) - 33 hooks (hooks/) - Composition blocks (_blocks/) - Documentation (docs/, README.md) - TS adapter packages (_ts_packages/) - Assembler (_assembler/) - Roles (_roles/) - Templates (_templates/) - Forgejo CI (.forgejo/) Author: Denis Parfionovich <info@greendragon.info> License: see LICENSE.
35 lines
1 KiB
Rust
35 lines
1 KiB
Rust
//! `Store` — thin shim over `kei_entity_store::Store` wired to
|
|
//! `DISCOVER_SCHEMA`.
|
|
//!
|
|
//! Two constructors: `open(path)` for on-disk and `open_memory()` for
|
|
//! unit tests. The inner connection is exposed read-only via `.conn()`
|
|
//! so the per-verb modules can call `kei_entity_store::verbs::*`
|
|
//! directly without taking a mutable borrow on the Store.
|
|
|
|
use crate::error::DiscoverError;
|
|
use crate::schema::DISCOVER_SCHEMA;
|
|
use kei_entity_store::Store as EntityStore;
|
|
use rusqlite::Connection;
|
|
use std::path::Path;
|
|
|
|
pub struct Store {
|
|
inner: EntityStore,
|
|
}
|
|
|
|
impl Store {
|
|
pub fn conn(&self) -> &Connection {
|
|
self.inner.conn()
|
|
}
|
|
}
|
|
|
|
pub fn open(path: &Path) -> Result<Store, DiscoverError> {
|
|
let inner = EntityStore::open(path, &[&DISCOVER_SCHEMA])
|
|
.map_err(|e| DiscoverError::Storage(e.to_string()))?;
|
|
Ok(Store { inner })
|
|
}
|
|
|
|
pub fn open_memory() -> Result<Store, DiscoverError> {
|
|
let inner = EntityStore::open_memory(&[&DISCOVER_SCHEMA])
|
|
.map_err(|e| DiscoverError::Storage(e.to_string()))?;
|
|
Ok(Store { inner })
|
|
}
|