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

Add metadata ADR #194

Merged
merged 6 commits into from
Jan 24, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions adr/ADR-00.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Metadata for Stream and Consumer

|Metadata|Value|
|--------|-----|
|Date |2023-01-23|
|Author |@Jarema|
|Status |Proposed|
Jarema marked this conversation as resolved.
Show resolved Hide resolved
|Tags |jetstream, client, server|

## Context and Problem Statement

Until now, there was no way to easily add additional information about Stream or Consumer.
The only solution was using `Description` field, which is a not ergonomic workaround.

## Server PR
https://github.com/nats-io/nats-server/pull/3797

## Design

The solution is to add new `metadata` field to both `Consumer` and `Stream` config.
The `metadata` field would by a map of `string` keys and `string` values.

### JSON representation
The map would be represented in json as object with nested key/value pairs, which is a default
way to marshal maps/hashmaps in most languages.

### Size limit
To avoid abuse of the metadata, the size of it is limited to 128kB.
Size is equal to len of all keys and values summed.

### Reserved prefix
`_nats` is a reserved prefix.
Will be used for any potential internals of server or clients.
Server can lock its metadata to be immutable and deny any changes.
ripienaar marked this conversation as resolved.
Show resolved Hide resolved


### Example
```json
{
"durable_name": "consumer",
... // other consumer/stream fields
"metadata": {
"owner": "nack",
"domain": "product",
"_nats_created_version": "1.10.0"
ripienaar marked this conversation as resolved.
Show resolved Hide resolved
}
}

```