Expand description
Core engine for Shard — a local-first, content-addressed, peer-to-peer version control system designed for large machine learning artifacts.
shard-core implements chunking (fixed-size and FastCDC content-defined), self-describing
SHRD v1 compression/encryption envelopes (Zstd/Zlib + AES-256-GCM with AAD),
Ed25519-signed commit DAGs, branching/merging, CRC32-checksummed WAL recovery,
per-repo dual read/write locking (.shard.lock), garbage collection, backup/restore,
HuggingFace dataset export/import, an authenticated Axum HTTP API, and libp2p sync.
§Quickstart
use std::fs;
let dir = tempfile::tempdir()?;
let repo = dir.path();
shard_core::init(repo, "flat", "zstd", "fixed", None, false, true)?;
fs::write(repo.join("model.bin"), b"tensor weights v1")?;
shard_core::add(repo, &repo.join("model.bin"), true)?;
let commit_id = shard_core::commit(repo, "initial weights", "Alice <alice@example.com>", true)?;
shard_core::verify(repo, &commit_id, true)?;
let snap = shard_core::status_snapshot(repo)?;
assert_eq!(snap.head.as_deref(), Some(commit_id.as_str()));Re-exports§
pub use auth::cache_passphrase;pub use auth::unlock_repo;pub use backup::backup;pub use backup::export;pub use backup::import;pub use backup::restore;pub use hf::hf_pull;pub use hf::hf_push;pub use p2p_sync::peer_add;pub use p2p_sync::pull;pub use p2p_sync::push;pub use p2p_sync::relay;pub use p2p_sync::sync;pub use p2p_sync::transfer_list;pub use p2p_sync::transfer_remove;pub use repo::add;pub use repo::branch_create;pub use repo::branch_delete;pub use repo::branch_list;pub use repo::checkout;pub use repo::commit;pub use repo::config_get;pub use repo::config_set;pub use repo::diff;pub use repo::get_metrics;pub use repo::health;pub use repo::init;pub use repo::init_with_passphrase;pub use repo::key_list;pub use repo::key_rotate;pub use repo::key_verify;pub use repo::log_cmd;pub use repo::log_entries;pub use repo::merge;pub use repo::prune;pub use repo::recover;pub use repo::recover_checkout_journal;pub use repo::status;pub use repo::status_snapshot;pub use repo::tag_add;pub use repo::tag_list;pub use repo::verify;pub use repo::verify_with_options;pub use repo::LogEntry;pub use repo::StatusSnapshot;