From 4a3e15b12ee1fb3881c43c27e709b1479aee500d Mon Sep 17 00:00:00 2001 From: "R.I.Pienaar" Date: Wed, 25 Oct 2023 14:41:19 +0200 Subject: [PATCH] Support compression in KV Signed-off-by: R.I.Pienaar --- adr/ADR-8.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/adr/ADR-8.md b/adr/ADR-8.md index a61cdae3..37c15d36 100644 --- a/adr/ADR-8.md +++ b/adr/ADR-8.md @@ -16,6 +16,7 @@ | 2 | 2023-10-16 | Document read replica mirrors buckets | | 2 | 2023-10-16 | Document consistency guarantees | | 3 | 2023-10-19 | Formalize initial bucket topologies | +| 4 | 2023-10-25 | Support compression | ## Context @@ -47,6 +48,7 @@ additional behaviors will come during the 1.x cycle. * Key starting with `_kv` is reserved for internal use * CLI tool to manage the system as part of `nats`, compatible with client implementations * Accept arbitrary application prefixes, as outlined in [ADR-19](https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-19.md) + * Data Compression for NATS Server 2.10 ### 1.1 @@ -124,6 +126,9 @@ type Status interface { // Keys return a list of all keys in the bucket - not possible now except in caches Keys() ([]string, error) + // IsCompressed indicates if the data is compressed on disk + IsCompressed() bool + // BackingStore is a name indicating the kind of backend BackingStore() string @@ -138,6 +143,9 @@ Languages can choose to expose additional information about the bucket along wit the `Status` interface is above but the `JetStream` specific implementation can be cast to gain access to `StreamInfo()` for full access to JetStream state. +The choice of `IsCompressed()` as a method name is idiomatic for Go, language maintainers can make a similar idiomatic +choice. + Other languages do not have a clear 1:1 match of the above idea so maintainers are free to do something idiomatic. ## RoKV @@ -253,8 +261,9 @@ A bucket is a Stream with these properties: * Allow Direct is always set to `true`. (It can be modified out-of-band only if desired, but not through KV bucket update.) * Placement is allowed * Republish is allowed + * If compression is requested in the configuration set `compression` to `true` -Here is a full example of the `CONFIGURATION` bucket: +Here is a full example of the `CONFIGURATION` bucket with compression enabled: ```json { @@ -276,6 +285,7 @@ Here is a full example of the `CONFIGURATION` bucket: "rollup_hdrs": true, "deny_delete": true, "allow_direct": true, + "compression": true, "placement": { "cluster": "clstr", "tags": ["tag1", "tag2"]