forked from TrueCloudLab/frostfs-node
[#1059] shard: Add shard mode to shard Info
Provide shard mode information via `DumpInfo()`. Delete atomic field from Shard structure since it duplicates new field. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
86b90eb944
commit
375394dc99
8 changed files with 22 additions and 12 deletions
|
@ -37,11 +37,18 @@ func (m Mode) String() string {
|
|||
// Returns any error encountered that did not allow
|
||||
// setting shard mode.
|
||||
func (s *Shard) SetMode(m Mode) error {
|
||||
s.mode.Store(uint32(m))
|
||||
s.m.Lock()
|
||||
defer s.m.Unlock()
|
||||
|
||||
s.info.Mode = m
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Shard) getMode() Mode {
|
||||
return Mode(s.mode.Load())
|
||||
// GetMode returns mode of the shard.
|
||||
func (s *Shard) GetMode() Mode {
|
||||
s.m.RLock()
|
||||
defer s.m.RUnlock()
|
||||
|
||||
return s.info.Mode
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue