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

[ADDED] Exposes Bytes from stream info in KeyValueStatus #1092

Merged
merged 1 commit into from Sep 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions kv.go
Expand Up @@ -94,6 +94,9 @@ type KeyValueStatus interface {

// BackingStore indicates what technology is used for storage of the bucket
BackingStore() string

// Bytes returns the size in bytes of the bucket
Bytes() uint64
}

// KeyWatcher is what is returned when doing a watch.
Expand Down Expand Up @@ -956,6 +959,9 @@ func (s *KeyValueBucketStatus) BackingStore() string { return "JetStream" }
// StreamInfo is the stream info retrieved to create the status
func (s *KeyValueBucketStatus) StreamInfo() *StreamInfo { return s.nfo }

// Bytes is the size of the stream
func (s *KeyValueBucketStatus) Bytes() uint64 { return s.nfo.State.Bytes }

// Status retrieves the status and configuration of a bucket
func (kv *kvs) Status() (KeyValueStatus, error) {
nfo, err := kv.js.StreamInfo(kv.stream)
Expand Down