Skip to content

Commit

Permalink
Add metadata to object store
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
  • Loading branch information
Jarema committed Jun 14, 2023
1 parent 14229b8 commit 3344103
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions adr/ADR-20.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
|Status |Partially Implemented|
|Tags |jetstream, client, objectstore|

|Revision|Date|Author|Info|
|--------|----|------|----|
|1 |2021-11-03|@sscottf|Initial design|
|2 |2023-06-14|@jarema|Add metadata|

## Context

This document describes a design of a JetStream backed object store. This ADR is still considered Beta/Experimental and may be subject to change.
Expand Down Expand Up @@ -84,13 +89,14 @@ in the stream config like in KV.

```go
type ObjectStoreConfig struct {
Bucket string // used in stream name template
Description string // stream description
TTL time.Duration // stream max_age
MaxBytes int64 // stream max_bytes
Storage StorageType // stream storate_type
Replicas int // stream replicas
Placement Placement // stream placement
Bucket string // used in stream name template
Description string // stream description
Metadata map[string]string // stream metadata
TTL time.Duration // stream max_age
MaxBytes int64 // stream max_bytes
Storage StorageType // stream storate_type
Replicas int // stream replicas
Placement Placement // stream placement
}
```

Expand All @@ -110,6 +116,7 @@ type ObjectStoreConfig struct {
{
"name": "OBJ_MY-STORE",
"description" : "description",
"metadata": [{"owner": "infra"}],
"subjects": [
"$O.MY-STORE.C.>",
"$O.MY-STORE.M.>"
Expand Down Expand Up @@ -158,9 +165,10 @@ Object Meta is high level information about an object.

```go
type ObjectMeta struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Headers Header `json:"headers,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Headers Header `json:"headers,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`

// Optional options.
Opts ObjectMetaOptions `json:"options,omitempty"`
Expand Down Expand Up @@ -210,6 +218,7 @@ When the ObjectInfo message is retrieved from the server, use the message metada
{
"name": "object-name",
"description": "object-desc",
"metadata": [{"owner": "infra"}],
"headers": {
"key1": ["foo"],
"key2": ["bar", "baz"]
Expand Down Expand Up @@ -241,6 +250,9 @@ type ObjectStoreStatus interface {

// Description is the description supplied when creating the bucket
Description() string

// Bucket-level metadata
Metadata() map[string]string

// TTL indicates how long objects are kept in the bucket
TTL() time.Duration
Expand Down

0 comments on commit 3344103

Please sign in to comment.