feat(kv): add KvPurge for byte-reclaiming key purge (NATS rollup)#11
Merged
Conversation
delete() and delete_with_version() only append markers — on a bucket with no max_age their bytes accumulate against max_bytes forever. Add an additive KvPurge: KvWriter trait whose NATS impl issues a rollup purge (Nats-Rollup: sub) that drops all prior revisions of a subject and reclaims the bytes. Vended via KvStore::purge_writer() (default None, like the existing KvTtl split) so other backends and consumers are unaffected; advertised via ConnectionCapabilities::purge. Real-nats-server test proves a fill→purge round-trip strictly drops the stream's byte count. Patch-bump 0.7.0 -> 0.7.1 (additive, semver-compatible). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Additive
KvPurge: KvWritertrait; NATS impl issues a rollup purge(
Nats-Rollup: sub) that drops all prior revisions of a subject and reclaimsbytes — unlike
delete/delete_with_versionwhich only append markers.KvStore::purge_writer()(defaultNone, likeKvTtl) + advertisedvia
ConnectionCapabilities::purge; other backends/consumers unaffected.purge_reclaims_bytestest (real nats-server) proves fill→purge drops stream bytes.Needed by orchestrator dead-tombstone GC for
orch-service-generation.🤖 Generated with Claude Code