Skip to content

Commit

Permalink
node/object/put: push meta only if the consistency policy asks for it
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Karpy <[email protected]>
  • Loading branch information
carpawell committed Dec 10, 2024
1 parent 7e32e0e commit 83dbf8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
5 changes: 3 additions & 2 deletions pkg/services/object/put/distributed.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ type distributedTarget struct {
objMeta object.ContentMeta
networkMagicNumber uint32

cnrClient *chaintcontainer.Client
cnrClient *chaintcontainer.Client
metainfoConsistencyAttr string

metaMtx sync.RWMutex
objSharedMeta []byte
Expand Down Expand Up @@ -154,7 +155,7 @@ func (t *distributedTarget) Close() (oid.ID, error) {
return oid.ID{}, err
}

if t.localNodeInContainer {
if t.localNodeInContainer && t.metainfoConsistencyAttr != "" {
t.metaMtx.RLock()
defer t.metaMtx.RUnlock()

Expand Down
16 changes: 11 additions & 5 deletions pkg/services/object/put/streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/core/client"
"github.com/nspcc-dev/neofs-node/pkg/services/object/internal"
"github.com/nspcc-dev/neofs-node/pkg/services/object/util"
"github.com/nspcc-dev/neofs-sdk-go/container"
neofsecdsa "github.com/nspcc-dev/neofs-sdk-go/crypto/ecdsa"
"github.com/nspcc-dev/neofs-sdk-go/object"
"github.com/nspcc-dev/neofs-sdk-go/user"
Expand Down Expand Up @@ -237,11 +238,12 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) internal.Target {

return rt
},
relay: relay,
fmt: p.fmtValidator,
localNodeInContainer: prm.localNodeInContainer,
localNodeSigner: prm.localNodeSigner,
cnrClient: p.cfg.cnrClient,
relay: relay,
fmt: p.fmtValidator,
localNodeInContainer: prm.localNodeInContainer,
localNodeSigner: prm.localNodeSigner,
cnrClient: p.cfg.cnrClient,
metainfoConsistencyAttr: metaAttribute(prm.cnr),
}
}

Expand Down Expand Up @@ -271,3 +273,7 @@ func (p *Streamer) Close() (*PutResponse, error) {
id: id,
}, nil
}

func metaAttribute(cnr container.Container) string {
return cnr.Attribute("__NEOFS__METAINFO_CONSISTENCY")
}

0 comments on commit 83dbf8a

Please sign in to comment.