frostfs-node/cmd/frostfs-lens/internal/meta/list-graveyard.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

38 lines
984 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 listGraveyardCMD = &cobra.Command{
Use: "list-graveyard",
Short: "Graveyard listing",
Long: `List all the objects that have been covered with a Tomb Stone.`,
Run: listGraveyardFunc,
}
func init() {
common.AddComponentPathFlag(listGraveyardCMD, &vPath)
}
func listGraveyardFunc(cmd *cobra.Command, _ []string) {
db := openMeta(cmd)
defer db.Close()
var gravePrm meta.GraveyardIterationPrm
gravePrm.SetHandler(
func(tsObj meta.TombstonedObject) error {
cmd.Printf(
"Object: %s\nTS: %s\n",
tsObj.Address().EncodeToString(),
tsObj.Tombstone().EncodeToString(),
)
return nil
})
err := db.IterateOverGraveyard(cmd.Context(), gravePrm)
common.ExitOnErr(cmd, common.Errf("could not iterate over graveyard bucket: %w", err))
}