WIP: Morph: Add unit tests #2

Closed
dstepanov-yadro wants to merge 233 commits from TrueCloudLab/frostfs-node:master into object-3608-morph-unit-tests
Showing only changes of commit 3223402c90 - Show all commits

View file

@ -11,28 +11,28 @@ import (
) )
type objectsInWork struct { type objectsInWork struct {
m sync.RWMutex sync.RWMutex
objs map[oid.Address]struct{} objs map[oid.Address]struct{}
} }
func (oiw *objectsInWork) inWork(addr oid.Address) bool { func (oiw *objectsInWork) inWork(addr oid.Address) bool {
oiw.m.RLock() oiw.RLock()
_, ok := oiw.objs[addr] _, ok := oiw.objs[addr]
oiw.m.RUnlock() oiw.RUnlock()
return ok return ok
} }
func (oiw *objectsInWork) remove(addr oid.Address) { func (oiw *objectsInWork) remove(addr oid.Address) {
oiw.m.Lock() oiw.Lock()
delete(oiw.objs, addr) delete(oiw.objs, addr)
oiw.m.Unlock() oiw.Unlock()
} }
func (oiw *objectsInWork) add(addr oid.Address) { func (oiw *objectsInWork) add(addr oid.Address) {
oiw.m.Lock() oiw.Lock()
oiw.objs[addr] = struct{}{} oiw.objs[addr] = struct{}{}
oiw.m.Unlock() oiw.Unlock()
} }
// Policer represents the utility that verifies // Policer represents the utility that verifies