Skip to main content

uni_fork/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2024-2026 Dragonscale Team
3
4//! Fork diff/promote engine and background maintenance for uni-db.
5//!
6//! This crate holds the reusable *logic* of the uni-db fork subsystem:
7//!
8//! - [`types`] — the public diff/promote value types (`ForkDiff`,
9//!   `PromotePattern`, `PromoteReport`, …).
10//! - [`diff`] — [`compute_diff`] and [`run_promote`], generic over the
11//!   [`host`] traits.
12//! - [`host`] — `ForkQueryHost` / `ForkPromoteSink`, implemented by uni-db for
13//!   its `Session`/`Transaction` types.
14//! - [`maintenance`] — the TTL sweeper and fork-local index-builder task
15//!   skeletons, generic over `maintenance::ForkMaintenanceHost`.
16//!
17//! The fork *drivers* that construct `Session`/`UniInner` (`fork.rs`,
18//! `fork_schema.rs`, the `Uni::*` fork orchestration) stay in uni-db to avoid a
19//! dependency cycle; they delegate to this crate's engine.
20
21pub mod diff;
22pub mod host;
23pub mod maintenance;
24pub mod types;
25
26pub use diff::{compute_diff, run_promote};
27pub use host::{ForkPromoteSink, ForkQueryHost};
28pub use maintenance::{ForkMaintenanceHost, spawn_index_builder, spawn_sweeper};
29pub use types::{
30    DiffEdge, DiffVertex, EdgeDiff, EdgePropertyChange, ForkDiff, PromotePattern, PromoteReport,
31    PropertyChange, VertexDiff, VertexPropertyChange,
32};