Skip to content

Commit

Permalink
Merge pull request #1092 from nats-io/jnm/kv_expose_bytes
Browse files Browse the repository at this point in the history
[ADDED] Exposes Bytes from stream info in KeyValueStatus
  • Loading branch information
kozlovic committed Sep 23, 2022
2 parents 991297b + 820a067 commit 36d2b65
Showing 1 changed file with 6 additions and 0 deletions.
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

0 comments on commit 36d2b65

Please sign in to comment.