2022-08-23 14:05:32 +00:00
|
|
|
package meta
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal"
|
|
|
|
meta "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
|
2022-08-23 14:05:32 +00:00
|
|
|
"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) {
|
2022-08-24 12:09:52 +00:00
|
|
|
db := openMeta(cmd)
|
|
|
|
defer db.Close()
|
2022-08-23 14:05:32 +00:00
|
|
|
|
|
|
|
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(gravePrm)
|
|
|
|
common.ExitOnErr(cmd, common.Errf("could not iterate over graveyard bucket: %w", err))
|
|
|
|
}
|