Skip to main content

Module storage

Module storage 

Source
Expand description

The storage backend abstraction — storage::MemoryStore and the default, file-backed storage::NativeStore. Implement MemoryStore to run the wedge over a different backend (e.g. an in-memory one for WASM). Storage backend abstraction for crate::service::MemoryService.

The wedge orchestration (remember/recall/relate/forget/why/fusion) is written once, generic over MemoryStore, so it runs unchanged over any backend: the native, file-backed NativeStore (the default — nothing changes for existing callers), or an in-memory backend such as the one velesdb-wasm provides for the browser (no filesystem, no persistence feature).

Structs§

NativeStore
The default MemoryStore: the native, file-backed engine (velesdb-core’s Database/AgentMemory, requiring the persistence feature). Existing callers of MemoryService::open see no change — this is exactly what they already ran.
RawListedFact
One fact as FactStore::list hands it to the service layer: content split out, everything else — reserved keys and scaffolding markers included — still in payload so the service can apply its visibility policy exactly once for every backend.

Constants§

AUTO_DATE_FIELD
Reserved metadata key remember/remember_with_ttl auto-stamp with today’s date (a YYYYMMDD integer, [crate::clock::today_ymd]) whenever the caller didn’t already set it — see crate::service::MemoryService::remember_with_ttl for the full contract. A deliberate, documented exception to every other _veles_-namespaced key: [is_reserved_key] still names it (so it can never be confused with an arbitrary caller field), but unlike a true system key —
CTX_EVENT_FIELD
Marks a compilation event recorded for context_savings.
CTX_SOURCE_FIELD
Marks a stored compilation source, served back by retrieve_context_source.
CTX_WORKING_FIELD
Marks a saved working context, served back by load_working_context.
CTX_WORKING_INDEX_FIELD
Marks a project’s working-context index, read by list_working_contexts.
HUB_FIELD
Marks an entity hub minted by remember_extracted — graph scaffolding, never a fact the caller stored.
INTERNAL_MARKER_FIELDS
Every marker that identifies a stored fact as internal scaffolding rather than a caller memory. Facts of these five classes live in the same collection as caller facts and are written by exactly one path each; the markers are declared here, and imported by those paths, so the write and the exclusion cannot drift apart.

Traits§

ColumnStore
Structured columnar predicates fused with vector recall — one method today, but the facet where field enumeration and richer predicates will land (ColumnFilter’s op set is already non_exhaustive).
FactStore
Fact storage: write, by-id lookup, deletion, corpus size — the core facet every backend must provide. The other facets (RecallStore, GraphStore, ColumnStore) build on stored facts; a partial backend, or a test double, implements only the facets it serves and the compiler refuses calls to the rest (#1959).
GraphStore
Typed graph edges between facts — the facet behind relate/why and the hub walks. A backend without a graph simply does not implement it, and the service methods that need it stop existing for that backend at compile time.
MemoryStore
The full storage surface crate::service::MemoryService historically required: every facet at once. Kept as a supertrait alias so existing callers and bounds (S: MemoryStore) compile unchanged; the blanket impl makes it automatic for any backend that implements the facets, so there is nothing extra to implement and nothing to forget.
RecallStore
Vector recall over stored facts — the surface every crate::service::MemoryService::recall/search call goes through. FactStore is a supertrait because these queries return the content of the facts they rank; a backend cannot rank what it cannot store.

Functions§

is_internal_scaffolding
Whether a raw payload belongs to one of the five internal classes.
strip_reserved_keys
Drop reserved system keys from a raw payload, and collapse an empty-after-stripping map to None — the caller-facing shape every Recollection::metadata is built from. pub because a MemoryStore backend that assembles Recollections itself (query_columnar) must apply the same stripping the service layer applies on every other recall path, or reserved keys leak to callers on that one path only.
strip_reserved_keys_ref
strip_reserved_keys over a borrowed payload: clones only the surviving non-reserved entries. Use this when the payload isn’t already owned — cloning the whole map first would deep-copy the reserved content value (the full fact text) per hit, only to discard it.
validate_column_filter
Validate one recall_where column filter: a plain, non-reserved identifier field name and a scalar (string/number/boolean) value. pub and shared so every MemoryStore backend enforces the same documented contract — the field-name rule keeps a filter safe to place into query text (NativeStore builds VelesQL; values are always bound parameters), and rejects the reserved system columns (content, _veles_*) regardless of backend; the scalar rule turns what would be an opaque engine error into a clear client-input error.