Skip to content

Commit

Permalink
Simplify asset versioning
Browse files Browse the repository at this point in the history
Signed-off-by: R.I.Pienaar <[email protected]>
  • Loading branch information
ripienaar committed Nov 27, 2024
1 parent 005a0a7 commit d47905e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
5 changes: 3 additions & 2 deletions cli/object_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,9 @@ func (c *objCommand) showBucketInfo(store jetstream.ObjectStore) error {
if status.BackingStore() == "JetStream" {
cols.AddRow("JetStream Stream", nfo.Config.Name)

if len(nfo.Config.Metadata) > 0 {
cols.AddMapStringsAsValue("Metadata", nfo.Config.Metadata)
meta := jsm.FilterServerMetadata(nfo.Config.Metadata)
if len(meta) > 0 {
cols.AddMapStringsAsValue("Metadata", meta)
}

if nfo.Cluster != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/nats-io/jwt/v2 v2.7.2
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20241126010352-fa50c751ab3c
github.com/nats-io/nats.go v1.37.0
github.com/nats-io/nkeys v0.4.7
github.com/nats-io/nkeys v0.4.8
github.com/nats-io/nuid v1.0.1
github.com/prometheus/client_golang v1.20.5
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20241126010352-fa50c751ab3c h1:L
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20241126010352-fa50c751ab3c/go.mod h1:nI8h87Ryi/zcaQcDLSSVbMfomhyck+0oDqxR7NoZX0Y=
github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE=
github.com/nats-io/nats.go v1.37.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
github.com/nats-io/nkeys v0.4.8 h1:+wee30071y3vCZAYRsnrmIPaOe47A/SkK/UBDPdIV70=
github.com/nats-io/nkeys v0.4.8/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
github.com/nats-io/nsc/v2 v2.8.6-0.20231220104935-3f89317df670 h1:NQzs7g/+Z4kC4XsYsKCQlwRcM4Hk0VyKuz7F4zUgjvQ=
github.com/nats-io/nsc/v2 v2.8.6-0.20231220104935-3f89317df670/go.mod h1:Z2+aDD1PzpXk8kF1ro17cfGBzmBoWPbtvGW8hBssAdA=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
Expand Down
20 changes: 14 additions & 6 deletions internal/util/jetstream.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
// Copyright 2024 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package util

import (
Expand All @@ -10,15 +23,10 @@ func RenderMetaApi(cols *columns.Writer, metadata map[string]string) {
versionMeta := metadata[api.JSMetaCurrentServerVersion]
levelMeta := metadata[api.JSMetaCurrentServerLevel]
requiredMeta := metadata[api.JsMetaRequiredServerLevel]
createdVersion := metadata[api.JSMetaCreatedServerVersion]

if versionMeta != "" || levelMeta != "" || requiredMeta != "" {
if versionMeta != "" {
if createdVersion == "" || createdVersion == versionMeta {
cols.AddRow("Host Version", versionMeta)
} else {
cols.AddRowf("Host Version", "%s created on %s", versionMeta, createdVersion)
}
cols.AddRow("Host Version", versionMeta)
}

if levelMeta != "" || requiredMeta != "" {
Expand Down

0 comments on commit d47905e

Please sign in to comment.