Skip to main content

libgrite_core/
lib.rs

1//! Core library for Grite: event types, CRDT projections, hashing, and sled storage.
2//!
3//! This crate defines the data model and persistence layer used by all other Grite
4//! crates. It is pure Rust with no async runtime dependency.
5//!
6//! ## Data model
7//!
8//! - [`Event`] — the atomic unit of change
9//! - [`EventKind`] — what happened (issue created, label added, etc.)
10//! - [`IssueProjection`] — materialized view of an issue
11//!
12//! ## Storage
13//!
14//! - [`GriteStore`] — sled-backed key-value store with CRUD operations
15//! - [`LockedStore`] — process-safe wrapper using `flock`
16//!
17//! ## CRDT semantics
18//!
19//! Projections use deterministic merge rules:
20//! - **LWW** for title, body, state
21//! - **Commutative sets** for labels, assignees, dependencies
22//! - **Append-only** for comments, links, attachments
23
24pub mod config;
25pub mod context;
26pub mod error;
27pub mod export;
28pub mod hash;
29pub mod integrity;
30pub mod lock;
31pub mod projection;
32pub mod signing;
33pub mod store;
34pub mod types;
35
36pub use config::{
37    actor_dir, list_actors, load_repo_config, load_signing_key, repo_sled_path, save_repo_config,
38    RepoConfig,
39};
40pub use error::GriteError;
41pub use export::{export_json, export_markdown, ExportSince};
42pub use integrity::{
43    check_store_integrity, verify_event_hash, verify_store_signatures, CorruptEvent,
44    CorruptionKind, IntegrityReport, SignatureError,
45};
46pub use lock::{resource_hash, Lock, LockCheckResult, LockPolicy, LockStatus, DEFAULT_LOCK_TTL_MS};
47pub use signing::{verify_signature, SigningError, SigningKeyPair, VerificationPolicy};
48pub use store::{DbStats, GriteStore, IssueFilter, LockedStore, RebuildStats};
49pub use types::actor::ActorConfig;
50pub use types::context::{FileContext, ProjectContext, ProjectContextEntry};
51pub use types::event::{DependencyType, Event, EventKind, IssueState, SymbolInfo};
52pub use types::ids::{generate_actor_id, generate_issue_id, hex_to_id, id_to_hex};
53pub use types::issue::{IssueProjection, IssueSummary, Version};
54pub use types::{ActorId, EventId, IssueId};