Skip to content

Commit

Permalink
Merge pull request #1189 from ripienaar/meta_simplify
Browse files Browse the repository at this point in the history
Simplify asset versioning
  • Loading branch information
ripienaar authored Nov 28, 2024
2 parents 005a0a7 + c19775f commit 58adf65
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 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
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ require (
github.com/google/go-cmp v0.6.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/gosuri/uiprogress v0.0.1
github.com/jedib0t/go-pretty/v6 v6.6.2
github.com/jedib0t/go-pretty/v6 v6.6.3
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/klauspost/compress v1.17.11
github.com/mattn/go-isatty v0.0.20
github.com/nats-io/jsm.go v0.1.1-0.20241126113501-b6095211b00b
github.com/nats-io/jsm.go v0.1.1-0.20241128091442-da16cd219f9b
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-server/v2 v2.11.0-dev.0.20241127165413-cfaad68e19db
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
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/jedib0t/go-pretty/v6 v6.6.2 h1:27bLj3nRODzaiA7tPIxy9UVWHoPspFfME9XxgwiiNsM=
github.com/jedib0t/go-pretty/v6 v6.6.2/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E=
github.com/jedib0t/go-pretty/v6 v6.6.3 h1:nGqgS0tgIO1Hto47HSaaK4ac/I/Bu7usmdD3qvs0WvM=
github.com/jedib0t/go-pretty/v6 v6.6.3/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E=
github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
Expand Down Expand Up @@ -106,16 +106,16 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/nats-io/jsm.go v0.1.1-0.20241126113501-b6095211b00b h1:/cZAXRQjncFpqWWE5uCn1FN8eGu60F6HeYj+zTfX1l8=
github.com/nats-io/jsm.go v0.1.1-0.20241126113501-b6095211b00b/go.mod h1:u1bYBgRIiahmheRyOc+bLpZUkbMTkfmdsaPhs2FzS9c=
github.com/nats-io/jsm.go v0.1.1-0.20241128091442-da16cd219f9b h1:LNt3vx1htGxJ+jGw4nZ0xe+zKabImvOBf0XgujSPURc=
github.com/nats-io/jsm.go v0.1.1-0.20241128091442-da16cd219f9b/go.mod h1:JzvMg3G7JtwRnl+ZenOH6NVI73Kuc4kIM1YDRaI4xZs=
github.com/nats-io/jwt/v2 v2.7.2 h1:SCRjfDLJ2q8naXp8YlGJJS5/yj3wGSODFYVi4nnwVMw=
github.com/nats-io/jwt/v2 v2.7.2/go.mod h1:kB6QUmqHG6Wdrzj0KP2L+OX4xiTPBeV+NHVstFaATXU=
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20241126010352-fa50c751ab3c h1:Lq24aOAbP9Pr4E5Sqvghr6NNxV+FUGMM3ojHFzno8Js=
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-server/v2 v2.11.0-dev.0.20241127165413-cfaad68e19db h1:XSsKLcdTjNwRhhiPS2G193zgh7yCHjT5IRzRyTuI/Y0=
github.com/nats-io/nats-server/v2 v2.11.0-dev.0.20241127165413-cfaad68e19db/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 58adf65

Please sign in to comment.