forked from TrueCloudLab/frostfs-node
[#92] Embed policer's objectsInWork mutex
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
f9730f090d
commit
3223402c90
1 changed files with 7 additions and 7 deletions
|
@ -11,28 +11,28 @@ import (
|
|||
)
|
||||
|
||||
type objectsInWork struct {
|
||||
m sync.RWMutex
|
||||
sync.RWMutex
|
||||
objs map[oid.Address]struct{}
|
||||
}
|
||||
|
||||
func (oiw *objectsInWork) inWork(addr oid.Address) bool {
|
||||
oiw.m.RLock()
|
||||
oiw.RLock()
|
||||
_, ok := oiw.objs[addr]
|
||||
oiw.m.RUnlock()
|
||||
oiw.RUnlock()
|
||||
|
||||
return ok
|
||||
}
|
||||
|
||||
func (oiw *objectsInWork) remove(addr oid.Address) {
|
||||
oiw.m.Lock()
|
||||
oiw.Lock()
|
||||
delete(oiw.objs, addr)
|
||||
oiw.m.Unlock()
|
||||
oiw.Unlock()
|
||||
}
|
||||
|
||||
func (oiw *objectsInWork) add(addr oid.Address) {
|
||||
oiw.m.Lock()
|
||||
oiw.Lock()
|
||||
oiw.objs[addr] = struct{}{}
|
||||
oiw.m.Unlock()
|
||||
oiw.Unlock()
|
||||
}
|
||||
|
||||
// Policer represents the utility that verifies
|
||||
|
|
Loading…
Reference in a new issue