[#378] shard: Collect expired tombstones in GC every epoch

Add new epoch event handler to GC that finds all expired tombstones and
marks them and underlying objects to be removed. Shard uses callbacks
provided by the storage engine to mark underlying objects.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-17 15:27:40 +03:00 committed by Alex Vanin
parent 3d5169c4c9
commit 717f2beb47
5 changed files with 114 additions and 1 deletions

View file

@ -29,7 +29,10 @@ func (e *StorageEngine) AddShard(opts ...shard.Option) (*shard.ID, error) {
return nil, errors.Wrap(err, "could not generate shard ID")
}
e.shards[id.String()] = shard.New(append(opts, shard.WithID(id))...)
e.shards[id.String()] = shard.New(append(opts,
shard.WithID(id),
shard.WithExpiredObjectsCallback(e.processExpiredTombstones),
)...)
return id, nil
}