forked from TrueCloudLab/frostfs-node
[#1770] shard: Move NewEpoch event routing on SE level
It will allow dynamic shard management. Closing a shard does not allow removing event handlers. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
9374823950
commit
2d7166f8d0
7 changed files with 50 additions and 73 deletions
|
@ -176,6 +176,18 @@ func (e *StorageEngine) SetShardMode(id *shard.ID, m mode.Mode, resetErrorCounte
|
|||
return errShardNotFound
|
||||
}
|
||||
|
||||
// HandleNewEpoch notifies every shard about NewEpoch event.
|
||||
func (e *StorageEngine) HandleNewEpoch(epoch uint64) {
|
||||
ev := shard.EventNewEpoch(epoch)
|
||||
|
||||
e.mtx.RLock()
|
||||
defer e.mtx.RUnlock()
|
||||
|
||||
for _, sh := range e.shards {
|
||||
sh.NotificationChannel() <- ev
|
||||
}
|
||||
}
|
||||
|
||||
func (s hashedShard) Hash() uint64 {
|
||||
return hrw.Hash(
|
||||
[]byte(s.Shard.ID().String()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue