diff --git a/pkg/local_object_storage/metabase/db.go b/pkg/local_object_storage/metabase/db.go index 5621b51ca..579890938 100644 --- a/pkg/local_object_storage/metabase/db.go +++ b/pkg/local_object_storage/metabase/db.go @@ -10,7 +10,7 @@ import ( // DB represents local metabase of storage node. type DB struct { - path string + info Info *cfg @@ -41,8 +41,10 @@ func NewDB(opts ...Option) *DB { } return &DB{ - path: c.boltDB.Path(), - cfg: c, + info: Info{ + Path: c.boltDB.Path(), + }, + cfg: c, matchers: map[object.SearchMatchType]func(string, string, string) bool{ object.MatchUnknown: unknownMatcher, object.MatchStringEqual: stringEqualMatcher, @@ -54,11 +56,6 @@ func (db *DB) Close() error { return db.boltDB.Close() } -// Path returns the path to meta database. -func (db *DB) Path() string { - return db.path -} - func stringEqualMatcher(key, objVal, filterVal string) bool { switch key { default: diff --git a/pkg/local_object_storage/metabase/db_test.go b/pkg/local_object_storage/metabase/db_test.go index 4e27f35e9..ea43ad801 100644 --- a/pkg/local_object_storage/metabase/db_test.go +++ b/pkg/local_object_storage/metabase/db_test.go @@ -186,7 +186,7 @@ func TestDB_Path(t *testing.T) { defer releaseDB(db) - require.Equal(t, path, db.Path()) + require.Equal(t, path, db.DumpInfo().Path) } func newDB(t testing.TB) *DB { @@ -200,7 +200,7 @@ func newDB(t testing.TB) *DB { func releaseDB(db *DB) { db.Close() - os.Remove(db.Path()) + os.Remove(db.DumpInfo().Path) } func TestSelectNonExistentAttributes(t *testing.T) { diff --git a/pkg/local_object_storage/metabase/info.go b/pkg/local_object_storage/metabase/info.go new file mode 100644 index 000000000..906e21209 --- /dev/null +++ b/pkg/local_object_storage/metabase/info.go @@ -0,0 +1,12 @@ +package meta + +// Info groups the information about DB. +type Info struct { + // Full path to the metabase. + Path string +} + +// DumpInfo returns information about the DB. +func (db *DB) DumpInfo() Info { + return db.info +}