[#643] objsvc/put: Copy config to distributedTarget
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
96e690883f
commit
3fcf56f2fb
2 changed files with 9 additions and 17 deletions
|
@ -10,8 +10,6 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
|
||||
svcutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger"
|
||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer"
|
||||
"go.uber.org/zap"
|
||||
|
@ -27,17 +25,13 @@ type distributedTarget struct {
|
|||
obj *objectSDK.Object
|
||||
objMeta object.ContentMeta
|
||||
|
||||
*cfg
|
||||
|
||||
payload *payload
|
||||
|
||||
nodeTargetInitializer func(nodeDesc) preparedObjectTarget
|
||||
|
||||
getWorkerPool func([]byte) (util.WorkerPool, bool)
|
||||
|
||||
relay func(context.Context, nodeDesc) error
|
||||
|
||||
fmt *object.FormatValidator
|
||||
|
||||
log *logger.Logger
|
||||
}
|
||||
|
||||
// parameters and state of container traversal.
|
||||
|
@ -137,7 +131,7 @@ func (t *distributedTarget) WriteObject(ctx context.Context, obj *objectSDK.Obje
|
|||
|
||||
var err error
|
||||
|
||||
if t.objMeta, err = t.fmt.ValidateContent(t.obj); err != nil {
|
||||
if t.objMeta, err = t.fmtValidator.ValidateContent(t.obj); err != nil {
|
||||
return fmt.Errorf("(%T) could not validate payload content: %w", t, err)
|
||||
}
|
||||
|
||||
|
|
|
@ -215,13 +215,13 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) *distributedTarget {
|
|||
withBroadcast := !prm.common.LocalOnly() && (typ == objectSDK.TypeTombstone || typ == objectSDK.TypeLock)
|
||||
|
||||
return &distributedTarget{
|
||||
cfg: p.cfg,
|
||||
traversal: traversal{
|
||||
opts: prm.traverseOpts,
|
||||
|
||||
extraBroadcastEnabled: withBroadcast,
|
||||
},
|
||||
payload: getPayload(),
|
||||
getWorkerPool: p.getWorkerPool,
|
||||
nodeTargetInitializer: func(node nodeDesc) preparedObjectTarget {
|
||||
if node.local {
|
||||
return localTarget{
|
||||
|
@ -240,8 +240,6 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) *distributedTarget {
|
|||
return rt
|
||||
},
|
||||
relay: relay,
|
||||
fmt: p.fmtValidator,
|
||||
log: p.log,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,9 +277,9 @@ func (p *Streamer) Close(ctx context.Context) (*PutResponse, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (p *Streamer) getWorkerPool(pub []byte) (pkgutil.WorkerPool, bool) {
|
||||
if p.netmapKeys.IsLocalKey(pub) {
|
||||
return p.localPool, true
|
||||
func (c *cfg) getWorkerPool(pub []byte) (pkgutil.WorkerPool, bool) {
|
||||
if c.netmapKeys.IsLocalKey(pub) {
|
||||
return c.localPool, true
|
||||
}
|
||||
return p.remotePool, false
|
||||
return c.remotePool, false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue