Skip to main content

nusy_arrow_git/
lib.rs

1//! nusy-arrow-git — Graph-native git primitives for NuSy Arrow substrate.
2//!
3//! Provides 8 git primitives operating on Arrow RecordBatches, designed
4//! for versioning RDF-like knowledge graphs stored in `nusy-arrow-core`.
5//!
6//! # Primitives
7//!
8//! 1. **Object Store** — the live [`GitObjectStore`] wrapping `ArrowGraphStore`
9//! 2. **Commit** — snapshot state to Parquet + record in [`CommitsTable`]
10//! 3. **Checkout** — restore state from a commit's Parquet snapshot
11//! 4. **History DAG** — traverse parent_ids for [`log`] and [`ancestors`]
12//! 5. **Branch/Head (Refs)** — lightweight branch pointers via [`RefsTable`]
13//! 6. **Diff** — object-level comparison between commits via [`diff()`]
14//! 7. **Merge** — 3-way merge with conflict detection/resolution via [`merge()`]
15//! 8. **Save** — crash-safe persistence without creating a commit via [`save()`]
16//!
17//! # Performance (DGX Spark, 10K triples)
18//!
19//! | Operation | Measured | Gate |
20//! |-----------|----------|------|
21//! | Commit | ~3ms | < 25ms |
22//! | Checkout | ~1.3ms | < 25ms |
23//! | Commit+Checkout (H-GIT-1) | ~4.3ms | < 50ms |
24//! | Save+Restore (M-SAVE) | ~4.3ms | < 100ms |
25//! | Awakening (M-119) | ~1.3ms | < 200ms |
26//! | Batch add 10K | ~4.3ms | < 10ms |
27//!
28//! # Merge Conflict Resolution
29//!
30//! The [`merge()`] function detects conflicts (same subject+predicate with
31//! different objects across branches). Use [`merge_with_strategy`] for
32//! automatic resolution via [`MergeStrategy::Ours`], [`MergeStrategy::Theirs`],
33//! [`MergeStrategy::LastWriterWins`], or a custom closure.
34//!
35//! # Crash-Safe Persistence
36//!
37//! [`save()`] uses a WAL marker + atomic file rename pattern. If a save is
38//! interrupted, the previous Parquet files remain valid. [`save_with_options`]
39//! adds zstd compression and incremental saves (only dirty namespaces).
40
41pub mod blame;
42pub mod checkout;
43pub mod cherry_pick;
44pub mod commit;
45pub mod diff;
46pub mod history;
47pub mod merge;
48pub mod object_store;
49pub mod rebase;
50pub mod refs;
51pub mod remote;
52pub mod revert;
53pub mod save;
54
55pub use blame::{BlameEntry, blame};
56pub use checkout::checkout;
57pub use cherry_pick::cherry_pick;
58pub use commit::{Commit, CommitsTable, create_commit};
59pub use diff::{DiffEntry, DiffResult, diff, diff_nondestructive};
60pub use history::{ancestors, find_common_ancestor, log};
61pub use merge::{Conflict, MergeResult, MergeStrategy, Resolution, merge, merge_with_strategy};
62pub use object_store::{GitConfig, GitObjectStore};
63pub use rebase::{RebaseResult, rebase};
64pub use refs::{Ref, RefType, RefsTable};
65pub use remote::{
66    RemoteError, Snapshot, bytes_to_snapshot, restore_snapshot, snapshot_state, snapshot_to_bytes,
67};
68pub use revert::revert;
69pub use save::{
70    SaveMetrics, SaveOptions, persist_commits, restore, restore_commits, restore_full,
71    restore_named_batches, save, save_full, save_named_batches, save_with_options,
72};