2022-08-23 13:45:24 +00:00
|
|
|
package writecache
|
|
|
|
|
2022-08-24 12:09:52 +00:00
|
|
|
import (
|
2023-03-21 10:38:44 +00:00
|
|
|
"os"
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
common "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-lens/internal"
|
|
|
|
"git.frostfs.info/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 {
|
2023-03-21 10:38:44 +00:00
|
|
|
db, err := writecache.OpenDB(vPath, true, os.OpenFile)
|
2022-08-24 12:09:52 +00:00
|
|
|
common.ExitOnErr(cmd, common.Errf("could not open write-cache db: %w", err))
|
|
|
|
|
|
|
|
return db
|
|
|
|
}
|