[#92] Refactor policer and add some unit tests #485

Merged
fyrchik merged 3 commits from ale64bit/frostfs-node:fix/policer-refactor-test into master 2023-07-03 07:05:33 +00:00
Showing only changes of commit 7fcc999c2b - Show all commits

View file

@ -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