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 KV management to KV adr #283

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Changes from 1 commit
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
39 changes: 39 additions & 0 deletions adr/ADR-8.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
| 2 | 2023-10-16 | Document consistency guarantees |
| 3 | 2023-10-19 | Formalize initial bucket topologies |
| 4 | 2023-10-25 | Support compression |
| 5 | 2024-06-05 | Add KV management |


## Context
Expand Down Expand Up @@ -214,6 +215,44 @@ type KV interface {
}
```

## KV Management

This is set of operations on the KV stores from the JetStream context.

```go
// KeyValueManager is used to manage KeyValue stores. It provides methods to
// create, delete, and retrieve.
type KeyValueManager interface {
ripienaar marked this conversation as resolved.
Show resolved Hide resolved
// KeyValue will lookup and bind to an existing KeyValue store.
// Name can be `get_key_value`, or whatever name is idiomatic in given language.
KeyValue(ctx context.Context, bucket string) (KeyValue, error)

// CreateKeyValue will create a KeyValue store with the given
// configuration.
CreateKeyValue(ctx context.Context, cfg KeyValueConfig) (KeyValue, error)

// UpdateKeyValue will update an existing KeyValue store with the given
// configuration.
UpdateKeyValue(ctx context.Context, cfg KeyValueConfig) (KeyValue, error)

// CreateOrUpdateKeyValue will create a KeyValue store if it does not
// exist or update an existing KeyValue store with the given
// configuration (if possible).
CreateOrUpdateKeyValue(ctx context.Context, cfg KeyValueConfig) (KeyValue, error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have create/update behave correctly, there's no need for create update - that is just lazy api to simplify the checking without actually knowing what it did - this further propagates the pattern that shouldn't be there.


// DeleteKeyValue will delete given KeyValue store.
DeleteKeyValue(ctx context.Context, bucket string) error

// KeyValueStoreNames is used to retrieve a list of key value store
// names.
KeyValueStoreNames(ctx context.Context) KeyValueNamesLister
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KeyValueBucketNames


// KeyValueStores is used to retrieve a list of key value store
// statuses.
KeyValueStores(ctx context.Context) KeyValueLister
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KeyValueBuckets

}
```

## Storage Backends

We do have plans to support, and provide, commercial KV as part of our NGS offering, however there will be value in an
Expand Down
Loading