forked from TrueCloudLab/frostfs-node
85aacbbb10
Implement bolt-based metabase that is going to be used in local object storage. Implement Put/Get/Select methods. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
25 lines
528 B
Go
25 lines
528 B
Go
package meta
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
|
"go.etcd.io/bbolt"
|
|
)
|
|
|
|
// DB represents local metabase of storage node.
|
|
type DB struct {
|
|
boltDB *bbolt.DB
|
|
|
|
matchers map[object.SearchMatchType]func(string, string) bool
|
|
}
|
|
|
|
// NewDB creates, initializes and returns DB instance.
|
|
func NewDB(boltDB *bbolt.DB) *DB {
|
|
return &DB{
|
|
boltDB: boltDB,
|
|
matchers: map[object.SearchMatchType]func(string, string) bool{
|
|
object.MatchStringEqual: func(s string, s2 string) bool {
|
|
return s == s2
|
|
},
|
|
},
|
|
}
|
|
}
|