nats-io / nats-architecture-and-design

Architecture and Design Docs
Apache License 2.0
196 stars 21 forks source link

KV delete should allow wildcards #51

Open aricart opened 3 years ago

aricart commented 3 years ago

Overview

Since KV (ADR-8) can now have subjects with wildcards, it becomes very useful to implement delete to delete key sub-ranges kv.delete("a.*"). This allows applications to easily cleanup values that may be "hierarchical" in nature without knowing the possible values that may be stored underneath.

The current behavior is to reject values with wildcards, but this is inconsistent with history and watches. Presumably, this is not in parity with get, but possibly the API could be expanded to do an mget which can deal with ranges without having to resort to doing consumers on the underlying stream.

ripienaar commented 3 years ago

We need https://github.com/nats-io/nats-server/issues/2495 to be done for this - sure we can do without but wont be efficient.

At the same time we should add a ranged get variant that returns []Entry or itterator of Entry (whatever works for a specific language)

ripienaar commented 1 year ago

The server work for https://github.com/nats-io/nats-server/issues/2495 was done ages ago, so in theory we can do this now. Needs discussion.