Skip to main content

Crate casq_core

Crate casq_core 

Source
Expand description

§casq Core

A content-addressed file store (CAS) using BLAKE3 hashing.

This library provides the core functionality for storing and retrieving files and directories by their cryptographic hash. Objects are stored immutably with stable content IDs, using a tree-based directory representation.

§Features

  • Content-addressed storage: files/dirs stored by hash
  • Immutable objects with stable content IDs
  • Tree-based directory representation
  • Garbage collection for unreferenced objects
  • Named references (refs) as GC roots

§Example

use casq_core::{Store, Algorithm};
use std::path::Path;

// Initialize a new store
let store = Store::init("./my-store", Algorithm::Blake3)?;

// Add a file or directory
let hash = store.add_path(Path::new("./my-data"))?;

// Create a reference to the root hash
store.refs().add("backup", &hash)?;

// Garbage collect unreferenced objects
let stats = store.gc(false)?;
println!("Deleted {} objects", stats.objects_deleted);

// Materialize back to filesystem
store.materialize(&hash, Path::new("./restored"))?;

Structs§

GcStats
Statistics from a garbage collection run.
Hash
A 32-byte BLAKE3 hash digest.
Journal
Journal for tracking operations.
JournalEntry
A journal entry recording an operation.
ObjectHeader
A 16-byte object header.
OrphanRoot
Information about an orphaned object (blob or tree).
RefManager
Manages named references (GC roots) in the store.
Store
A content-addressed store.
TreeEntry
An entry in a tree (file or subdirectory).

Enums§

Algorithm
Supported hash algorithms.
EntryType
Entry type in a tree.
Error
Errors that can occur during store operations.
ObjectType
Object types.

Type Aliases§

FileMode
File mode (POSIX permissions).
Result
Result type alias using casq_core’s Error type.