forked from TrueCloudLab/frostfs-node
Remove outdated code of metabase and localstore
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
869d9e571c
commit
a875d80491
41 changed files with 1725 additions and 3123 deletions
42
pkg/local_object_storage/metabase/control.go
Normal file
42
pkg/local_object_storage/metabase/control.go
Normal file
|
@ -0,0 +1,42 @@
|
|||
package meta
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"go.etcd.io/bbolt"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// Open boltDB instance for metabase.
|
||||
func (db *DB) Open() error {
|
||||
err := os.MkdirAll(path.Dir(db.info.Path), db.info.Permission)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't create dir %s for metabase: %w", db.info.Path, err)
|
||||
}
|
||||
|
||||
db.log.Debug("created directory for Metabase", zap.String("path", db.info.Path))
|
||||
|
||||
db.boltDB, err = bbolt.Open(db.info.Path, db.info.Permission, db.boltOptions)
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't open boltDB database: %w", err)
|
||||
}
|
||||
|
||||
db.log.Debug("opened boltDB instance for Metabase")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Init initializes metabase, however metabase doesn't need extra preparations,
|
||||
// so it implemented to satisfy interface of storage engine components.
|
||||
func (db *DB) Init() error {
|
||||
db.log.Debug("Metabase has been initialized")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close closes boltDB instance.
|
||||
func (db *DB) Close() error {
|
||||
return db.boltDB.Close()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue