Invalidate list cache on container events #802

Merged
fyrchik merged 4 commits from fyrchik/frostfs-node:remove-invalidate-cache into master 2023-11-14 19:00:13 +00:00
Showing only changes of commit 3f61b3a677 - Show all commits

View file

@ -93,16 +93,12 @@ func configureEACLAndContainerSources(c *cfg, client *cntClient.Client, cnrSrc c
subscribeToContainerRemoval(c, func(e event.Event) { subscribeToContainerRemoval(c, func(e event.Event) {
ev := e.(containerEvent.DeleteSuccess) ev := e.(containerEvent.DeleteSuccess)
// read owner of the removed container in order to update the listing cache. cachedContainerStorage.handleRemoval(ev.ID)
// It's strange to read already removed container, but we can successfully hit info, err := cachedContainerStorage.DeletionInfo(ev.ID)
// the cache.
// TODO: use owner directly from the event after neofs-contract#256 will become resolved
cnr, err := cachedContainerStorage.Get(ev.ID)
if err == nil { if err == nil {
cachedContainerLister.update(cnr.Value.Owner(), ev.ID, false) cachedContainerLister.update(info.Owner, ev.ID, false)
} }
cachedContainerStorage.handleRemoval(ev.ID)
c.log.Debug(logs.FrostFSNodeContainerRemovalEventsReceipt, c.log.Debug(logs.FrostFSNodeContainerRemovalEventsReceipt,
zap.Stringer("id", ev.ID), zap.Stringer("id", ev.ID),
) )