nookdb_core/lib.rs
1//! Nook core engine.
2//!
3//! Pure-Rust embedded database. The JS binding lives in `nookdb-napi`;
4//! this crate has no NAPI dependencies and can be unit-tested without
5//! Node.
6
7pub mod backup;
8pub(crate) mod codec;
9pub mod collection;
10pub mod database;
11pub mod error;
12pub mod index;
13pub mod license_verify;
14pub mod live;
15pub mod migrate;
16pub mod notify;
17pub mod schema;
18pub mod storage;
19
20pub use database::Database;
21pub use error::{NookError, NookErrorKind};
22pub use storage::{Entry, ReadTx, WriteTx};
23
24/// Storage value-codec injection seam (extension seam §6a). Implement
25/// [`ValueCodec`] in an external crate to transform stored values (e.g.
26/// at-rest encryption) without forking or modifying nookdb-core;
27/// [`IdentityCodec`] is the default pass-through (plain JSON on disk).
28pub use codec::doc::{IdentityCodec, ValueCodec};
29
30/// Migration-runner API seam (extension seam §6b). Re-exported for
31/// crate-root convenience; the full module is at [`migrate`].
32pub use migrate::{MigrationStatus, Runner};
33
34/// Post-commit notifier seam (extension seam, M3). Implement
35/// [`CommitObserver`] in an external crate and attach via
36/// [`Database::add_observer`] to observe commits without forking
37/// nookdb-core.
38pub use notify::{ChangeOp, CommitEvent, CommitObserver, DocChange, Notifier, ObserverHandle};
39
40/// Reactive subsystem. `LiveEngine` is constructed by the binding from
41/// the opened `Database` + compiled `SchemaIr`; `EmitSink` is the
42/// core↔binding emit boundary (core stays NAPI-free).
43pub use live::{EmitSink, LiveEngine, SubId};
44
45pub use backup::{
46 backup_to_path, read_backup, restore_from_path, write_backup, BackupStats, RestoreOptions,
47 RestoreStats,
48};
49
50/// Offline ed25519 license-token verification utility (extension seam
51/// "any milestone — dormant license-verify utility"). Dormant in the MIT
52/// core; consumed by external integrators (post-1.0). No network
53/// calls; algorithm pinned to Ed25519. Full module: [`license_verify`].
54pub use license_verify::{verify as verify_license, LicenseClaims, NookLicenseError};