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