· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·

Object Store

Content-Addressable Storage
Core Concepts / Object Store

Content-Addressable Storage

At the heart of Astral lies the Object Store, a content-addressable storage system that forms the foundation for all versioning operations. Understanding this layer helps you appreciate why Astral is both fast and reliable.


What is Content-Addressable Storage?

Instead of storing files by name, Astral stores everything by its cryptographic hash—a unique fingerprint derived from the content itself.

Content → Hash → Storage
file
Your Content
"Hello, World"
Blake3 Hash
8f2a1c3d4e5f...
Object ID
Unique identifier

Key Properties

  1. Deterministic: Same content always produces the same hash
  2. Collision-resistant: Different content produces different hashes
  3. Fast: Blake3 hashes at ~14 GB/s
  4. Secure: Cryptographically strong hashing

Object Types

Astral stores three types of objects:

Blob

Raw file content. The actual bytes of your files, compressed and stored by hash.

Tree

Directory structure. Maps file names to blob hashes, creating the filesystem hierarchy.

Commit

A snapshot in time. Points to a tree and contains metadata (author, message, parent).


How It Works

Saving a File

When you save a file, Astral:

1. Reads the file content
2. Computes the Blake3 hash
3. If the hash exists → reuse (deduplication!)
4. If new → compress and store the blob
5. Update the tree to reference this blob
Object Storage Path
.asl/objects/
├── 8f/
│   └── 2a1c3d4e5f6789...  ← First 2 chars as directory
├── 4b/
│   └── 1d9e2a3b4c5678...
└── 1a/
  └── 2b3c4d5e6f7890...

Automatic Deduplication

If you have 100 copies of the same file across different commits, Astral stores it once:

# All these identical files share one blob
project-v1/config.json    → 8f2a1c3d
project-v2/config.json    → 8f2a1c3d  (same hash = same blob)
project-v3/config.json    → 8f2a1c3d  (reused, not re-stored)

Blake3 Performance

Astral uses Blake3, a modern cryptographic hash function designed for speed:

Hashing Benchmark
Blake3 (Astral)14.0 GB/s
SHA-2562.0 GB/s
SHA-1 (Git)1.5 GB/s

Why Blake3?

  • Parallel by design: Takes advantage of multi-core CPUs
  • Secure: 256-bit security level
  • Incremental: Can hash streaming data
  • Versatile: Works as a general-purpose hash, MAC, and KDF

Inspecting Objects

Astral provides commands to inspect the object store:

# Show object type and content
asl cat-object 8f2a1c3d

# Show object type only
asl cat-object -t 8f2a1c3d

# Show object size
asl cat-object -s 8f2a1c3d
Example Output
$ asl cat-object 8f2a1c3d

Object Type: blob
Size: 1,247 bytes
Content:
───────────────────
Hello, World!
This is my file content.
───────────────────

Implications

Understanding the object store explains many of Astral's behaviors:

✓ Immutability

Objects are never modified. A different hash means different content. History is append-only.

✓ Integrity

Every read verifies the hash. Corruption is detected immediately.

✓ Efficiency

Deduplication means large repos with similar files stay compact.

✓ Speed

Hash comparisons are instant. Checking if content exists is O(1).


Next Steps

└─── End of Document ───┘