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

[FEAT] add method to bind to existing KVs #276

Merged
merged 1 commit into from
Mar 30, 2022
Merged

[FEAT] add method to bind to existing KVs #276

merged 1 commit into from
Mar 30, 2022

Conversation

Jarema
Copy link
Member

@Jarema Jarema commented Mar 29, 2022

This method allows binding to existing KV without creating it.

@Jarema Jarema requested a review from aricart March 29, 2022 12:26
@@ -92,6 +93,9 @@ class ViewsImpl implements Views {
kv(name: string, opts: Partial<KvOptions> = {}): Promise<KV> {
return Bucket.create(this.js, name, opts);
}
bind(name: string, codec?: KvCodecs): Promise<KV> {
Copy link
Member

Choose a reason for hiding this comment

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

this needs to be triggered by an option in KvOptions. - the views interface should simply be the raw functionality - kv, object store, etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

@aricart so basically additional "bind" option in KvOptions?

Copy link
Member

Choose a reason for hiding this comment

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

yes!

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed.

went with bindOnly as thats more self-explenatory and clear IMO.

@Jarema Jarema requested a review from aricart March 29, 2022 18:14
Copy link
Member

@aricart aricart left a comment

Choose a reason for hiding this comment

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

LGTM - with the exception of that arg should be optional and we should prepare for other things without flipping the signature.

static async bind(
js: JetStreamClient,
name: string,
codec: KvCodecs = NoopKvCodecs(),
Copy link
Member

Choose a reason for hiding this comment

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

make the sig (js: JetStreamClient, name: string, opts: {codec: KvCodec} = {})

Copy link
Member

@aricart aricart left a comment

Choose a reason for hiding this comment

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

LGTM

@Jarema Jarema merged commit a1ba7a5 into main Mar 30, 2022
@Jarema Jarema deleted the jarema/add-bind branch March 30, 2022 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants