-
Notifications
You must be signed in to change notification settings - Fork 705
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
[UPDATED] Added json tags to KeyValueConfig struct to behave consistently with the StreamConfig one #1630
[UPDATED] Added json tags to KeyValueConfig struct to behave consistently with the StreamConfig one #1630
Conversation
Signed-off-by: Mattia Barbisan <pricelessrabbit@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I have one suggestion regarding the tag name.
Other than that, I don't think omitempty
matters a lot in that case since we never really serialize the config from within the library. If anything, I would probably use omitempty
to represent optionality of those fields, similarly to how we have it in object store - i.e. only bucket name would not have it.
jetstream/kv.go
Outdated
|
||
// Replicas is the number of replicas to keep for the KeyValue store in | ||
// clustered jetstream. Defaults to 1, maximum is 5. | ||
Replicas int | ||
Replicas int `json:"replicas"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be consistent with stream config, this should probably be num_replicas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just pushed the fix with num_replicas
and also changed omitempty
like the object storage ones 🐰
- udpated "omitempty" options to match the object store config ones Signed-off-by: Mattia Barbisan <pricelessrabbit@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one more nit I only noticed now.
kv.go
Outdated
Description string `json:"description,omitempty"` | ||
MaxValueSize int32 `json:"max_value_size,omitempty"` | ||
History uint8 `json:"history,omitempty"` | ||
TTL time.Duration `json:"ttl,omitempty,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that, I did not notice at first, you have doubled omitempty
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sry, fixed!
Signed-off-by: Mattia Barbisan <pricelessrabbit@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for the contribution!
…ntly with the StreamConfig one (#1630) Signed-off-by: Mattia Barbisan <pricelessrabbit@gmail.com>
…ntly with the StreamConfig one (#1630) Signed-off-by: Mattia Barbisan <pricelessrabbit@gmail.com>
…ntly with the StreamConfig one (#1630) Signed-off-by: Mattia Barbisan <pricelessrabbit@gmail.com>
…ntly with the StreamConfig one (#1630) Signed-off-by: Mattia Barbisan <pricelessrabbit@gmail.com>
This PR add json tags to the
KeyValueConfig
struct like the ones already present inStreamConfig
.This is useful when working with KV buckets because currently you need a map or support struct to marshal / unmarshal a bucket config to / from JSON.
StreamConfig
tags as reference.omitempty
option for the fields that have it inStreamConfig
, but a check is needed for the other ones.