haematite 0.7.0

Content-addressed, branchable, actor-native storage engine
Documentation
pub mod carrier;
pub mod ids;
/// Shared content-addressed reachability walk (STORAGE-VACUUM.md §2): the one
/// DFS `branch::prune` and `db::vacuum::mark` both traverse through. Native-only
/// — mirrors `branch::prune`'s gate exactly, so the module is present precisely
/// when its consumers are and never compiles dead into the wasm32 rung.
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
pub(crate) mod reachability;
pub mod store;
pub mod sync_codec;
pub mod tree;
pub mod wal;

pub use ids::{KvKey, KvValue, ShardId};

// Native-only modules. These pull in the actor runtime (beamr/tokio), the
// distribution layer, and filesystem persistence, none of which target
// wasm32-unknown-unknown. They are gated out of the wasm build (R1, CN1).
#[cfg(not(feature = "wasm"))]
pub mod api;
pub mod branch;
#[cfg(all(feature = "wasm", target_arch = "wasm32", target_os = "unknown"))]
pub mod browser_local;
#[cfg(not(feature = "wasm"))]
pub mod db;
// FENCE-CHAIN r8 R1a: the single directory-entry fsync primitive plus its
// `cfg(test)` journal. Native-only (never compiled into the wasm rung), so the
// instrumentation is inert there by construction.
#[cfg(not(feature = "wasm"))]
pub(crate) mod fence;
#[cfg(not(feature = "wasm"))]
pub(crate) mod shard;
#[cfg(not(feature = "wasm"))]
pub mod sync;
#[cfg(not(feature = "wasm"))]
pub mod ttl;

// The `wasm` module is declared on every target so the browser transport's
// platform-neutral frame core and its native sync-codec parity tests (WASM-003)
// compile and run under `cargo test --lib`. The browser-only submodules
// (`detect`, `runtime`) and the `web_sys::WebSocket` carrier inside `transport`
// stay behind `wasm`/`wasm32` cfg gates, so no web-sys leaks into the native
// build.
pub mod wasm;

mod error;

// §9 DISPATCH PINS (CHUNKING-POLICY §4.1, r1 B3): every production `batch_mutate*`
// caller driven under a v2 policy + the mixed-policy path-convergence pin. Native
// only — its callers (branch/sync/wal) are gated out of the wasm build.
#[cfg(all(test, not(feature = "wasm")))]
#[path = "chunking_dispatch_pins_tests.rs"]
mod chunking_dispatch_pins_tests;

pub use error::Error;

pub use store::{CacheError, DeleteNode, LruCache, MemoryStore, NodeStore};

#[cfg(not(feature = "wasm"))]
pub use store::{DiskStore, StoreError};
#[cfg(feature = "wasm")]
pub use store::{IndexedDbStore, IndexedDbStoreError};

pub use tree::{
    BoundaryDetector, Cursor, Hash, InternalNode, LeafNode, Node, NodeError, RangeIter, TreeError,
    TreePolicy, batch_mutate, delete, insert,
};
pub use tree::{DiffEntry, DiffError, diff};

pub use wal::{LookupResult, Mutation, OperationType, WalBuffer, WalEntry, WalError};

#[cfg(not(feature = "wasm"))]
pub use wal::{DurableWal, FsyncPolicy, RecoveredWal, WalFileContents, WalRecovery};

#[cfg(not(feature = "wasm"))]
pub use branch::{
    BranchCommitError, BranchError, BranchHandle, BranchKind, BranchPolicyError, BranchRefError,
    BranchRefRecord, BranchRefStore, BranchRegistry, BranchShardRef, CheckoutError,
    CommitDurability, CommitLog, CommitLogEntry, CommitOutcome, CommitRequest, ConflictError,
    ConflictInput, ConflictPolicy, CustomMergeFn, MergeConflict, MergeError, MergeReport,
    PruneError, PruneReport, ReadOnlyView, SnapshotEntry, SnapshotError, SnapshotRegistry,
    Timestamp, checkout, commit_branch, create_branch, create_branch_with_kind, current_timestamp,
    fork, fork_at, fork_from, fork_from_with_kind, fork_registered, fork_shards,
    fork_shards_registered, merge, open_branch, prune, remove_branch,
};

#[cfg(not(feature = "wasm"))]
pub use api::{
    ApiError, CasMismatch, Event, EventStore, KvEntry, KvRange, ScanResult, SequenceConflict,
    ShardRoots, StreamMeta, decode_stream_key, encode_stream_key,
};

#[cfg(not(feature = "wasm"))]
pub use db::{
    Database, DatabaseConfig, DatabaseError, DistributedDatabaseConfig, ON_DISK_FORMAT_VERSION,
    ObservedEntry, ObserverError, ReadOnlyDatabase, respond_to_inbound_writes,
};

#[cfg(not(feature = "wasm"))]
pub use sync::{
    Ack, ConsistencyError, ConsistencyMode, ConvergenceProperties, DistributionEndpoint,
    EventualConsistency, InboundSync, NoopSyncPullTrigger, QuorumOutcome, StrongConsistency,
    SyncMergeError, SyncMergeResult, SyncMergeRoots, SyncNodeId, SyncPair, SyncPullTrigger,
    SyncSchedulerConfig, SyncSchedulerError, SyncSchedulerHandle, SyncSchedulerStats, SyncTopology,
    TopologyError, WriteMembership, execute_with_consistency, quorum_size, wait_for_quorum,
    wait_for_quorum_from_receiver,
};

#[cfg(feature = "wasm-runtime")]
pub use wasm::{WasmRuntime, WasmRuntimeError, WasmShardHandle, WasmShardRuntime};