diff --git a/pkg/local_object_storage/shard/delete.go b/pkg/local_object_storage/shard/delete.go index 1cfba1e3..e19f2c33 100644 --- a/pkg/local_object_storage/shard/delete.go +++ b/pkg/local_object_storage/shard/delete.go @@ -1,8 +1,11 @@ package shard import ( + "errors" + "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/common" meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase" + "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/writecache" oid "github.com/nspcc-dev/neofs-sdk-go/object/id" "go.uber.org/zap" ) @@ -39,7 +42,7 @@ func (s *Shard) Delete(prm DeletePrm) (DeleteRes, error) { for i := range prm.addr { if s.hasWriteCache() { err := s.writeCache.Delete(prm.addr[i]) - if err != nil && !IsErrNotFound(err) { + if err != nil && !IsErrNotFound(err) && !errors.Is(err, writecache.ErrReadOnly) { s.log.Warn("can't delete object from write cache", zap.String("error", err.Error())) } } diff --git a/pkg/local_object_storage/writecache/writecache.go b/pkg/local_object_storage/writecache/writecache.go index 4d53c8a2..f5c3f880 100644 --- a/pkg/local_object_storage/writecache/writecache.go +++ b/pkg/local_object_storage/writecache/writecache.go @@ -23,6 +23,12 @@ type Info struct { type Cache interface { Get(address oid.Address) (*object.Object, error) Head(oid.Address) (*object.Object, error) + // Delete removes object referenced by the given oid.Address from the + // Cache. Returns any error encountered that prevented the object to be + // removed. + // + // Returns apistatus.ObjectNotFound if object is missing in the Cache. + // Returns ErrReadOnly if the Cache is currently in the read-only mode. Delete(oid.Address) error Iterate(IterationPrm) error Put(common.PutPrm) (common.PutRes, error)