CompactionConfig
Defined in: packages/core/src/compaction-config.ts:7
Configuration for history compaction behavior.
Compaction creates snapshot nodes in the Merkle-DAG that summarize the full CRDT state, allowing peers to skip replaying the full change history.
Properties
Section titled “Properties”enabled
Section titled “enabled”enabled:
boolean
Defined in: packages/core/src/compaction-config.ts:9
Enable automatic compaction; when false, only manual document.snapshot() is available.
gcAfterPrune
Section titled “gcAfterPrune”gcAfterPrune:
boolean
Defined in: packages/core/src/compaction-config.ts:33
After pruning the in-memory sync tree, delete the orphaned blocks from the Helia blockstore. Opt-in because deletion is destructive: once a block is gone, peers that lazy-load it via PeerborneDocument.loadChangeBlock or that re-broadcast the change will not be able to fetch the data locally.
Only blocks that are no longer reachable from the in-memory sync tree (and
are not the snapshot boundary CID) are deleted, so accidentally re-attached
ACL nodes are safe. CIDs remain in the in-memory _hashes set so duplicate
incoming sync messages are still deduplicated.
Has no effect when pruneAfterSnapshot is false.
keepRecentNodes
Section titled “keepRecentNodes”keepRecentNodes:
number
Defined in: packages/core/src/compaction-config.ts:36
Keep at least N recent change nodes after pruning so slightly-behind peers can catch up.
minChangesBeforeSnapshot
Section titled “minChangesBeforeSnapshot”minChangesBeforeSnapshot:
number
Defined in: packages/core/src/compaction-config.ts:15
Minimum document changes before the first snapshot, to avoid premature snapshots.
pruneAfterSnapshot
Section titled “pruneAfterSnapshot”pruneAfterSnapshot:
boolean
Defined in: packages/core/src/compaction-config.ts:18
Prune old nodes from the in-memory sync tree after a snapshot. ACL nodes are always preserved.
snapshotInterval
Section titled “snapshotInterval”snapshotInterval:
number
Defined in: packages/core/src/compaction-config.ts:12
Create a snapshot every N document changes (ACL changes do not count).