Skip to main content

plugmem_core/
lib.rs

1#![doc = include_str!("../README.md")]
2//! plugmem engine core.
3//!
4//! The `no_std + alloc`, single-threaded memory engine on top of
5//! [`plugmem_arena`]: the data model (facts, entities, edges,
6//! bitemporality), the indexes (BM25, temporal, graph, vectors), hybrid
7//! recall, and the snapshot/journal machinery. The core owns no I/O, no
8//! clock and no threads — timestamps arrive as parameters, bytes leave
9//! through the `Storage` trait.
10//!
11//! Design: `..05`. Implementation lands in stages 2-4; modules
12//! appear here in dependency order as those stages complete.
13
14#![no_std]
15// The engine holds zero `unsafe`: every byte-reinterpretation lives in
16// `plugmem_arena`, behind its single audited `unsafe`. Forbidding it here turns
17// "the core is UB-free" into a compile-time guarantee — which is why the MIRI
18// audit covers only the arena, not this crate's (necessarily safe) code.
19#![forbid(unsafe_code)]
20
21extern crate alloc;
22
23pub mod config;
24pub mod error;
25pub mod id;
26pub mod index;
27pub mod journal;
28pub mod memory;
29pub(crate) mod metadata;
30pub mod model;
31pub mod snapshot;
32pub mod storage;
33pub mod tokenizer;
34
35pub use config::{Config, MAX_HNSW_DEGREE, MAX_SHARDS};
36pub use error::Error;
37pub use id::{EdgeId, EntityId, FactId, NONE_U32};
38pub use memory::{
39    DEFAULT_TAG_PAGE_LIMIT, FactFault, FactView, GuardedRememberOutcome, LinkInput,
40    MAX_TAG_PAGE_LIMIT, MAX_VECTOR_SPACE_ID_BYTES, MaintainReport, MaintenanceMode,
41    MaintenanceOptions, Memory, OpenReport, RecallQuery, RecallResult, RecallScratch, RecalledEdge,
42    RecalledFact, ReembedError, ReembedReport, RememberInput, RememberOutcome, RemoveTagReport,
43    ShardLayout, Similar, SimilarReason, Stats, TagPage, TagQuery, TagSummary, UnlinkInput,
44};
45pub use model::{
46    EdgeSlot, EntityByName, EntityRecord, FactAux, FactRecord, TemporalSlot, VALID_TO_OPEN,
47    fact_flags,
48};
49pub use storage::{MemScratch, MemStorage, Scratch, Storage};
50// The arena-layer ids that appear in model records are part of this
51// crate's public surface too.
52pub use plugmem_arena::{BlobId, TermId};
53// The arena's own error appears inside `Error::Arena`, so anything matching on
54// it needs the type without depending on the arena crate directly.
55pub use plugmem_arena::Error as ArenaError;