frostfs-node/pkg/local_object_storage/metabase/info.go
Pavel Karpy fdeea1dfac [] meta: Fix concurrent mode changes
Includes:
1. mode change read lock operation in every exported method that r/w the
underlying database;
2. returning `ErrDegradedMode` logical error if any exported method is
called in degraded (without a metabase) mode.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-11-19 11:01:04 +03:00

22 lines
345 B
Go

package meta
import (
"io/fs"
)
// Info groups the information about DB.
type Info struct {
// Full path to the metabase.
Path string
// Permission of database file.
Permission fs.FileMode
}
// DumpInfo returns information about the DB.
func (db *DB) DumpInfo() Info {
db.modeMtx.RLock()
defer db.modeMtx.RUnlock()
return db.info
}