Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emitting :key_deleted when key is purged #157

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lsxliron
Copy link

  • Now :key_deleted event is emitted when wither purging or deleting a key
  • Moved operations module attributes to KV module for better readability

Fixes #156

@lsxliron lsxliron marked this pull request as ready for review April 19, 2024 04:42
Copy link
Collaborator

@mmmries mmmries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think there will ever be a case where someone cares about the difference between delete vs purge? I don't use the KV functionality much, so I'm not sure about the semantics of this API

@mmmries
Copy link
Collaborator

mmmries commented Apr 21, 2024

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
Copy link
Author

lsxliron commented Apr 21, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KV watcher does not fire when key is purged
2 participants