nats.go
nats.go copied to clipboard
Add `KeysWithFilter` methods to KV interface
Proposed change
// KeysWithFilters returns a filtered list of keys in the bucket.
KeysWithFilters(filter []string) ([]string, error)
// And for the new, iterable API:
ListKeysWithFilters(filter []string) (KeyLister, error)
// KeysWithFilters returns a filtered list of keys in the bucket.
// Historically this method returned a complete slice of all keys in the bucket,
// however clients should return interable result.
// Languages can implement the list of filters in most idiomatic way - as an iterator, variadic argument, slice, etc.
// When multiple filters are passed, client library should check `consumer info` from `consumer create method` if the filters are matching,
// as nats-server < 2.10 would ignore them.
KeysWithFilters(filter []string) ([]string, error)
We have two separate functions for single and multiple filters, as multiple filters requires server 2.10
reference ADR: https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-8.md?plain=1#L139 reference ADR issue: https://github.com/nats-io/nats-architecture-and-design/issues/289
Use case
https://github.com/nats-io/nats-server/issues/5540
Contribution
No response
In the case of go at least, wouldnt a WatchOpt be better? These commands already take those.
Hey please checkout PR #1658, any suggestion would be helpful.
@Jarema is this issue still open. I would like to work on this. Please assign me this issue.
Hi @Jarema , worked on the Go one too, would love to have your comments. 😄