2022-08-23 13:45:24 +00:00
|
|
|
package writecache
|
|
|
|
|
2022-08-24 12:09:52 +00:00
|
|
|
import (
|
2022-12-23 17:35:35 +00:00
|
|
|
common "github.com/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal"
|
|
|
|
"github.com/TrueCloudLab/frostfs-node/pkg/local_object_storage/writecache"
|
2022-08-24 12:09:52 +00:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"go.etcd.io/bbolt"
|
|
|
|
)
|
2022-08-23 13:45:24 +00:00
|
|
|
|
|
|
|
var (
|
|
|
|
vAddress string
|
|
|
|
vPath string
|
|
|
|
vOut string
|
|
|
|
)
|
|
|
|
|
|
|
|
// Root contains `write-cache` command definition.
|
|
|
|
var Root = &cobra.Command{
|
|
|
|
Use: "write-cache",
|
|
|
|
Short: "Operations with write-cache",
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
Root.AddCommand(listCMD, inspectCMD)
|
|
|
|
}
|
2022-08-24 12:09:52 +00:00
|
|
|
|
|
|
|
func openWC(cmd *cobra.Command) *bbolt.DB {
|
|
|
|
db, err := writecache.OpenDB(vPath, true)
|
|
|
|
common.ExitOnErr(cmd, common.Errf("could not open write-cache db: %w", err))
|
|
|
|
|
|
|
|
return db
|
|
|
|
}
|