Skip to Content
DocsConceptsShallow Snapshots and Redaction

Shallow Snapshots

Quick Reference

Shallow snapshots are like Git’s shallow clone - maintain current state while removing old history. Essential for privacy compliance, storage optimization, and performance.

Basic Usage

const = new (); // ... extensive editing history ... // Regular snapshot - full history const = .({ : "snapshot" }); // Shallow snapshot - trimmed history const = .({ : "shallow-snapshot", : .(), }); // Typically 70-90% smaller .(`Size reduction: ${100 - (. / . * 100)}%`);

Content Redaction

const = new (); const = .("content"); // Sensitive data added .(0, "SSN: 123-45-6789. "); .(18, "Public info."); // Redact sensitive part .(0, 18); // Create clean snapshot const = .({ : "shallow-snapshot", : .(), }); // Sensitive data permanently removed from history

Synchronization Limitations

⚠️ Important: Peers can only sync if they have versions after the shallow snapshot point.

Common Patterns

Archive and Trim

async function (: ) { // 1. Archive full history const = .({ : "snapshot" }); await (); // 2. Create shallow for active use const = .({ : "shallow-snapshot", : .(), }); return ; } async function (: ) { // Save to cold storage }

Privacy-Aware Design

class { constructor(private : ) {} async () { // Delete sensitive content this..("private").(0, this..("private").); // Create clean snapshot return this..({ : "shallow-snapshot", : this..(), }); } }

Best Practices

  • Coordinate before trimming: Ensure all peers synchronized
  • Archive before deletion: Keep full history backup if needed
Last updated on