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
[ADDED] Exposes Bytes from stream info in KeyValueStatus #1092
Conversation
LGTM. Also update ADR pls |
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
ADR updated (nats-io/nats-architecture-and-design#159) |
@jnmoyne Merged. |
note that object store exposes this as |
Personally I prefer If anything I'd say object store should be changed to |
(but this is not about the stream, but the materialized views. In all cases bytes, length, size will be an issue, which will require them to go to the doc. Also - on the JavaScript clients I exposed the underlying stream info, wondering if that is also a good practice for all clients on the buckets (KV or ObjectStore) as it reduce the need to add API to telegraph the stream info information. |
Go allows you to get the underlying stream info - but it should not be the happy path. We should not forget that backend portability is still a concern to keep in mind for these so the core KV API should provide the things most people need, but with escape hatches for really weird requirements where one might want to do backend specific behaviors. |
My interpretation of the |
Yes, correct that’s the behaviour I am referring to. So I think the status interface needs to have a way to get the size without accessing the stream info. Definitely seems like a oversight on my part when designing that status interface. |
Right, which is what this PR does for the Go client lib or are you thinking of something else? I was also wondering if the status interface should also include something to return the number of keys for which there is a value stored in the bucket? |
I am just confirming I agree with the PR :) And specifically pointing out that not exposing stream info as a designed in feature and we really should avoid it for the happy path in response to the JS comments from Alberto. keys perhaps helpful but we should maybe take a look at etcd and vault APIs to see if they expose it? The current interface was heavily built around the common feature of those (see end of ADR) |
Currently, in order to get the size in bytes of a bucket people are resorting to getting the stream info directly adding themselves a hard coded "KV_" prefix to the bucket name which is not great and not future proof. This exposes
Bytes()
which is already present ins.nfo
in KeyValueBucketStatus.