[#188] shard: Implement SetMode method

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-19 15:56:10 +03:00 committed by Alex Vanin
parent 2fb379b7dd
commit 3fa3661cad
2 changed files with 16 additions and 0 deletions

View file

@ -40,3 +40,15 @@ func (m Mode) String() string {
return "EVACUATE"
}
}
// SetMode sets mode of the shard.
//
// Returns any error encountered that did not allow
// to set shard mode.
func (s *Shard) SetMode(m Mode) error {
s.mode.Store(uint32(m))
}
func (s *Shard) getMode() Mode {
return Mode(s.mode.Load())
}