[#378] shard: Collect expired non-tombstone objects in GC every epoch

Add new epoch event handler to GC that finds all expired non-tombstone
objects and marks them to be removed.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-16 20:34:45 +03:00 committed by Alex Vanin
parent 89a22450e5
commit dab45050b9
2 changed files with 60 additions and 3 deletions

View file

@ -40,9 +40,16 @@ func (s *Shard) Init() error {
}
gc := &gc{
gcCfg: s.gcCfg,
remover: s.removeGarbage,
mEventHandler: map[eventType]*eventHandlers{},
gcCfg: s.gcCfg,
remover: s.removeGarbage,
mEventHandler: map[eventType]*eventHandlers{
eventNewEpoch: {
cancelFunc: func() {},
handlers: []eventHandler{
s.collectExpiredObjects,
},
},
},
}
gc.init()