Skip to content

Commit

Permalink
(list-objects, scrub): version-changed, version-removed
Browse files Browse the repository at this point in the history
* part two, prev. commit: 939d7a6

Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Jan 15, 2025
1 parent 939d7a6 commit 37271ae
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 24 deletions.
4 changes: 2 additions & 2 deletions cmd/cli/cli/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ func printLso(c *cli.Context, entries cmn.LsoEntries, lstFilter *lstFilter, prop
propsList := splitCsv(props)
if isRemote && !addStatusCol {
if addCachedCol && !cos.StringInSlice(apc.GetPropsStatus, propsList) {
for _, e := range entries {
if e.IsVerChanged() {
for _, en := range entries {
if en.IsAnyFlagSet(apc.EntryVerChanged | apc.EntryVerRemoved) {
addStatusCol = true
break
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/cli/scrub.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,11 @@ func (scr *scrBp) upd(parent *scrCtx, en *cmn.LsoEnt) {
scr.log(parent, en, teb.ScrLargeSz)
}

if en.IsVerChanged() {
if en.IsAnyFlagSet(apc.EntryVerChanged) {
scr.Stats[teb.ScrVchanged].Cnt++
scr.Stats[teb.ScrVchanged].Siz += en.Size
scr.log(parent, en, teb.ScrVchanged)
} else if en.IsVerRemoved() {
} else if en.IsAnyFlagSet(apc.EntryVerRemoved) {
scr.Stats[teb.ScrVremoved].Cnt++
scr.Stats[teb.ScrVremoved].Siz += en.Size
scr.log(parent, en, teb.ScrVremoved)
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/NVIDIA/aistore/cmd/cli
go 1.23.4

require (
github.com/NVIDIA/aistore v1.3.26-0.20250108155940-8c676ef07b6d
github.com/NVIDIA/aistore v1.3.26-0.20250115193147-939d7a64d226
github.com/fatih/color v1.18.0
github.com/json-iterator/go v1.1.12
github.com/onsi/ginkgo/v2 v2.21.0
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
code.cloudfoundry.org/bytefmt v0.0.0-20190710193110-1eb035ffe2b6/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/NVIDIA/aistore v1.3.26-0.20250108155940-8c676ef07b6d h1:dEWTFT5KVO32GAw68uGfiz4WqOwPP5XVps8l5KZOqa0=
github.com/NVIDIA/aistore v1.3.26-0.20250108155940-8c676ef07b6d/go.mod h1:mjhY9OGIZULaC79+iRfzEUvUZw7aIWklJ8um321QVpw=
github.com/NVIDIA/aistore v1.3.26-0.20250115193147-939d7a64d226 h1:lOtbuxNtpQIx26uh1JYINTu+SsCvpNrZrit3hbW12vk=
github.com/NVIDIA/aistore v1.3.26-0.20250115193147-939d7a64d226/go.mod h1:CqUKZjhqSTocBlK0XMSYRPGMsoNOFKLwHIkyhOto6uc=
github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
Expand Down
7 changes: 4 additions & 3 deletions cmd/cli/teb/init.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package teb contains templates and (templated) tables to format CLI output.
/*
* Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
*/
package teb

Expand All @@ -14,16 +14,17 @@ import (
var Writer io.Writer

var (
fred, fcyan, fgreen func(format string, a ...any) string
fred, fcyan, fgreen, fblue func(format string, a ...any) string
)

func Init(w io.Writer, noColor bool) {
Writer = w
if noColor {
fred, fcyan, fgreen = fmt.Sprintf, fmt.Sprintf, fmt.Sprintf
fred, fcyan, fgreen, fblue = fmt.Sprintf, fmt.Sprintf, fmt.Sprintf, fmt.Sprintf
} else {
fred = color.New(color.FgHiRed).Sprintf
fcyan = color.New(color.FgHiCyan).Sprintf
fgreen = color.New(color.FgHiGreen).Sprintf
fblue = color.New(color.FgHiBlue).Sprintf
}
}
24 changes: 13 additions & 11 deletions cmd/cli/teb/lso.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package teb contains templates and (templated) tables to format CLI output.
/*
* Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2025, NVIDIA CORPORATION. All rights reserved.
*/
package teb

Expand Down Expand Up @@ -80,17 +80,19 @@ func LsoTemplate(propsList []string, hideHeader, addCachedCol, addStatusCol bool
// formatting
//

func fmtLsObjStatus(e *cmn.LsoEnt) string {
switch e.Status() {
func fmtLsObjStatus(en *cmn.LsoEnt) string {
switch en.Status() {
case apc.LocOK:
if !e.IsPresent() {
if !en.IsPresent() {
return UnknownStatusVal
}
switch {
case e.IsVerChanged():
case en.IsAnyFlagSet(apc.EntryVerChanged):
return fcyan("version-changed")
case e.IsVerRemoved():
return fred("deleted")
case en.IsAnyFlagSet(apc.EntryVerRemoved):
return fblue("deleted") // as in note: deleted
case en.IsAnyFlagSet(apc.EntryHeadFail):
return fred("remote-error")
default:
return "ok"
}
Expand All @@ -103,14 +105,14 @@ func fmtLsObjStatus(e *cmn.LsoEnt) string {
case apc.LocIsCopyMissingObj:
return "replica(object-is-missing)"
default:
debug.Assertf(false, "%#v", e)
debug.Assertf(false, "%#v", en)
return "invalid"
}
}

func fmtLsObjIsCached(e *cmn.LsoEnt) string {
if e.IsDir() {
func fmtLsObjIsCached(en *cmn.LsoEnt) string {
if en.IsDir() {
return ""
}
return FmtBool(e.IsPresent())
return FmtBool(en.IsPresent())
}
2 changes: 1 addition & 1 deletion cmd/ishard/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/NVIDIA/aistore/cmd/ishard
go 1.23.4

require (
github.com/NVIDIA/aistore v1.3.26-0.20250108155940-8c676ef07b6d
github.com/NVIDIA/aistore v1.3.26-0.20250115193147-939d7a64d226
github.com/json-iterator/go v1.1.12
github.com/vbauerster/mpb/v4 v4.12.2
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/ishard/go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
code.cloudfoundry.org/bytefmt v0.0.0-20190710193110-1eb035ffe2b6/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc=
github.com/NVIDIA/aistore v1.3.26-0.20250108155940-8c676ef07b6d h1:dEWTFT5KVO32GAw68uGfiz4WqOwPP5XVps8l5KZOqa0=
github.com/NVIDIA/aistore v1.3.26-0.20250108155940-8c676ef07b6d/go.mod h1:mjhY9OGIZULaC79+iRfzEUvUZw7aIWklJ8um321QVpw=
github.com/NVIDIA/aistore v1.3.26-0.20250115193147-939d7a64d226 h1:lOtbuxNtpQIx26uh1JYINTu+SsCvpNrZrit3hbW12vk=
github.com/NVIDIA/aistore v1.3.26-0.20250115193147-939d7a64d226/go.mod h1:CqUKZjhqSTocBlK0XMSYRPGMsoNOFKLwHIkyhOto6uc=
github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM=
Expand Down

0 comments on commit 37271ae

Please sign in to comment.