CAS Playground
Experience content-addressed storage hands-on. Type text, paste content, or generate random data — watch Graviton's chunking, hashing, and deduplication algorithms work in real time.
How it works
The playground uses the same algorithms as the JVM-side CasBlobStore:
- Chunking — splits input into fixed-size blocks (configurable 8–256 bytes for demo)
- Hashing — computes a real SHA-256 digest for each block via
pt.kcry:sha - Deduplication — tracks which block digests have been seen before
- Iron types —
BlockSize,Sha256Hex,BlockIndexenforce invariants at the type level
Build Checklist
- Run
./sbt buildFrontendfrom the repo root. - Run
cd docs && npm run docs:dev. - Navigate to this page.
Try These Experiments
1. Duplicate Detection
- Type "hello world" and click Ingest
- Type "hello world" again and click Ingest again
- Watch the second ingest show 100% dedup ratio — all blocks are duplicates!
2. Partial Overlap
- Type "AAAA BBBB CCCC DDDD" with block size 4
- Then type "AAAA BBBB XXXX DDDD"
- See which blocks are fresh (changed) and which are deduplicated (unchanged)
3. Block Size Impact
- Enter a paragraph of text
- Try different block sizes (8, 32, 64, 128, 256)
- Notice how smaller blocks find more dedup opportunities but create more metadata
4. Random Data
- Switch to Random Data mode
- Generate 512 bytes and ingest
- Generate another 512 bytes — since random data rarely repeats, expect 0% dedup
Architecture
The CAS Playground mirrors the production pipeline:
Input Bytes → Fixed-Size Chunker → Per-Block SHA-256 → Dedup Check → Block Map
│ │ │
▼ ▼ ▼
Chunk[Byte] Sha256Hex Fresh | DuplicateIn the real Graviton runtime, this pipeline is composed using the Transducer algebra:
scala
val ingest = BombGuard(maxBytes) >>> countBytes >>> hashBytes() >>> rechunk(blockSize) >>> blockKeyDeriverEach >>> composes two stages sequentially, merging their summary Records automatically. The playground visualizes what each stage produces.
Iron Types
All types in the playground are cross-compiled Iron refined types from graviton.shared.cas:
| Type | Constraint |
|---|---|
BlockSize | `Int : |
BlockIndex | `Int : |
ByteCount | `Long : |
Sha256Hex | `String : |
HexDigest | `String : |
Algo | `String : |