frostfs-node/cmd/frostfs-lens/internal/meta/list-garbage.go
Dmitrii Stepanov 059e9e88a2 [#373] metabase: Add metrics
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-06-21 15:13:26 +03:00

33 lines
884 B
Go

package meta
import (
common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal"
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
"github.com/spf13/cobra"
)
var listGarbageCMD = &cobra.Command{
Use: "list-garbage",
Short: "Garbage listing",
Long: `List all the objects that have received GC Mark.`,
Run: listGarbageFunc,
}
func init() {
common.AddComponentPathFlag(listGarbageCMD, &vPath)
}
func listGarbageFunc(cmd *cobra.Command, _ []string) {
db := openMeta(cmd)
defer db.Close()
var garbPrm meta.GarbageIterationPrm
garbPrm.SetHandler(
func(garbageObject meta.GarbageObject) error {
cmd.Println(garbageObject.Address().EncodeToString())
return nil
})
err := db.IterateOverGarbage(cmd.Context(), garbPrm)
common.ExitOnErr(cmd, common.Errf("could not iterate over garbage bucket: %w", err))
}