fdeea1dfac
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>
22 lines
345 B
Go
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
|
|
}
|