Crate jacquard_repo

Crate jacquard_repo 

Source
Expand description

AT Protocol repository primitives

This crate provides building blocks for working with AT Protocol repositories:

  • MST (Merkle Search Tree): Immutable tree operations with deterministic structure
  • Commits: Signed commit structures (versions 2 and 3) with signature verification
  • CAR I/O: Import and export repositories in CAR (Content Addressable aRchive) format
  • Storage: Pluggable block storage abstraction with in-memory and file-backed implementations

§Design Philosophy

  • Core primitives are always available (MST, commits, storage)
  • Optional high-level Repository API for convenience
  • Immutable MST operations for referential transparency
  • Zero-copy deserialization where possible
  • Support for both current and future sync protocol versions

Note: thank you very much to Rudy and Clinton, rsky was very helpful in figuring this all out.

§Example

use jacquard_repo::{Mst, MemoryBlockStore};
use cid::Cid;

let storage = MemoryBlockStore::new();
let mst = Mst::new(storage);

// Add entries
let cid = /* ... */;
let new_mst = mst.add("app.bsky.feed.post/abc123", cid).await?;

// Retrieve
if let Some(value) = new_mst.get("app.bsky.feed.post/abc123").await? {
    println!("Found: {}", value);
}

Re-exports§

pub use error::RepoError;
pub use error::RepoErrorKind;
pub use error::Result;
pub use mst::Mst;
pub use mst::MstDiff;
pub use mst::WriteOp;
pub use repo::CommitData;
pub use repo::Repository;
pub use storage::BlockStore;
pub use storage::FileBlockStore;
pub use storage::LayeredBlockStore;
pub use storage::MemoryBlockStore;

Modules§

car
CAR (Content Addressable aRchive) utilities CAR (Content Addressable aRchive) file I/O
commit
Commit structures and signature verification Commit structures and signature verification for AT Protocol repositories.
error
Error types for repository operations
mst
Merkle Search Tree implementation Merkle Search Tree implementation
repo
High-level repository operations High-level repository operations
storage
Block storage abstraction Block storage abstraction for MST nodes and records

Constants§

DAG_CBOR_CID_CODEC
DAG-CBOR codec identifier for CIDs (0x71)