nats-io / nats.ex

Elixir client for NATS, the cloud native messaging system. https://nats.io
MIT License
207 stars 36 forks source link

Emitting `:key_deleted` when key is purged #157

Open lsxliron opened 6 months ago

lsxliron commented 6 months ago

Fixes #156

mmmries commented 6 months ago

I don't know go very well, but I think this bit of the go-client is exposing purge events separately from delete events? https://github.com/nats-io/nats.go/blob/9d4b227179d60d6996c32b4b889d4e325ee06f78/kv.go#L982-L989

lsxliron commented 6 months ago

@mmmries i just started using the KV so I’m not an expert. The end result is the same, the key is removed from the bucket (history stays when using del and removed when using purge).

However, when the watcher process starts, you will still get historical events for a key that was deleted but not for a key that was purged.

Edit It shouldn’t be hard to add a purge event if needed though