forked from TrueCloudLab/frostfs-node
[#1632] node/container: Update GET cache on successful removal
In previous implementation storage node responded with the removed container up until cache invalidation due to TTL. In order to avoid false-positive responses node should update its cache on `DeleteSuccess` events. Make node to call `handleRemoval` method of the container cache which leads to subsequent `apistatus.ErrContainerNotFound` errors. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
a529149e6f
commit
d15a7d8d3d
2 changed files with 15 additions and 6 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
cntClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/object/acl/eacl"
|
||||
putsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/put"
|
||||
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
|
||||
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
||||
netmapSDK "github.com/nspcc-dev/neofs-sdk-go/netmap"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/user"
|
||||
|
@ -147,6 +148,10 @@ func newCachedContainerStorage(v container.Source) *ttlContainerStorage {
|
|||
return (*ttlContainerStorage)(lruCnrCache)
|
||||
}
|
||||
|
||||
func (s *ttlContainerStorage) handleRemoval(cnr cid.ID) {
|
||||
(*ttlNetCache)(s).set(cnr.EncodeToString(), nil, apistatus.ContainerNotFound{})
|
||||
}
|
||||
|
||||
// Get returns container value from the cache. If value is missing in the cache
|
||||
// or expired, then it returns value from side chain and updates the cache.
|
||||
func (s *ttlContainerStorage) Get(cnr cid.ID) (*container.Container, error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue