forked from TrueCloudLab/frostfs-node
[#1714] lens: Add open*COMPONENT*
funcs
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
01d7c007aa
commit
fa18100489
10 changed files with 58 additions and 60 deletions
|
@ -1,7 +1,12 @@
|
|||
package meta
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
common "github.com/nspcc-dev/neofs-node/cmd/neofs-lens/internal"
|
||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||
"github.com/spf13/cobra"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -28,3 +33,17 @@ func init() {
|
|||
listGarbageCMD,
|
||||
)
|
||||
}
|
||||
|
||||
func openMeta(cmd *cobra.Command) *meta.DB {
|
||||
db := meta.New(
|
||||
meta.WithPath(vPath),
|
||||
meta.WithBoltDBOptions(&bbolt.Options{
|
||||
ReadOnly: true,
|
||||
Timeout: 100 * time.Millisecond,
|
||||
}),
|
||||
meta.WithEpochState(epochState{}),
|
||||
)
|
||||
common.ExitOnErr(cmd, common.Errf("could not open metabase: %w", db.Open(true)))
|
||||
|
||||
return db
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue