nats-io / nats-architecture-and-design

Architecture and Design Docs
Apache License 2.0
206 stars 22 forks source link

Ensure full coverage of KV management methods #284

Open Jarema opened 5 months ago

Jarema commented 5 months ago

Overview

The KV ADR has been updated here: https://github.com/nats-io/nats-architecture-and-design/pull/283

Please make sure that your client covers all the methods mentioned in the change:

// KeyValueManager is used to manage KeyValue buckets. It provides methods to
// create, delete, and retrieve.
type KeyValueManager interface {
    // KeyValue will lookup and bind to an existing KeyValue bucket.
    // 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 bucket with the given
    // configuration.
    CreateKeyValue(ctx context.Context, cfg KeyValueConfig) (KeyValue, error)

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

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

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

    // KeyValueBucketNames is used to retrieve a list of key value bucket
    // names.
    KeyValueBuckerNames(ctx context.Context) KeyValueNamesLister

    // KeyValueBuckets is used to retrieve a list of key value bucket
    // statuses.
    KeyValueBuckets(ctx context.Context) KeyValueLister
}

Keep the names idiomatic for your language.

Clients and Tools

Other Tasks

Client authors please update with your progress. If you open issues in your own repositories as a result of this request, please link them to this one by pasting the issue URL in a comment or main issue description.

mtmk commented 4 months ago

Note that we're not implementing CreateOrUpdateKeyValue for .NET since there is no equivalent JetStream API for managing streams. We can implement it after an atomic create-or-update-stream function is implemented server side.

edit naming seems to be confusing btw makes you think updating the value of a 'key'