arrow_graph_git/lib.rs
1//! arrow-git — Graph-native git primitives for Arrow-based knowledge graphs.
2//!
3//! Provides 8 git primitives operating on Arrow RecordBatches, designed
4//! for versioning RDF-like knowledge graphs stored in `arrow-graph-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 (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 compat;
46pub mod diff;
47pub mod history;
48pub mod merge;
49pub mod object_store;
50pub mod rebase;
51pub mod refs;
52pub mod remote;
53pub mod revert;
54pub mod save;
55
56pub use blame::{BlameEntry, blame};
57pub use checkout::checkout;
58pub use cherry_pick::cherry_pick;
59pub use commit::{Commit, CommitsTable, create_commit};
60pub use diff::{DiffEntry, DiffResult, diff, diff_nondestructive};
61pub use history::{ancestors, find_common_ancestor, log};
62pub use merge::{Conflict, MergeResult, MergeStrategy, Resolution, merge, merge_with_strategy};
63pub use object_store::{GitConfig, GitObjectStore};
64pub use rebase::{RebaseResult, rebase};
65pub use refs::{Ref, RefType, RefsTable};
66pub use remote::{
67 RemoteError, Snapshot, bytes_to_snapshot, restore_snapshot, snapshot_state, snapshot_to_bytes,
68};
69pub use revert::revert;
70pub use save::{
71 SaveMetrics, SaveOptions, persist_commits, restore, restore_commits, restore_full,
72 restore_named_batches, save, save_full, save_named_batches, save_with_options,
73};