forked from TrueCloudLab/frostfs-node
[#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"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/object"
|
||||||
svcutil "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util"
|
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/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"
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer"
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/transformer"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -27,17 +25,13 @@ type distributedTarget struct {
|
||||||
obj *objectSDK.Object
|
obj *objectSDK.Object
|
||||||
objMeta object.ContentMeta
|
objMeta object.ContentMeta
|
||||||
|
|
||||||
|
*cfg
|
||||||
|
|
||||||
payload *payload
|
payload *payload
|
||||||
|
|
||||||
nodeTargetInitializer func(nodeDesc) preparedObjectTarget
|
nodeTargetInitializer func(nodeDesc) preparedObjectTarget
|
||||||
|
|
||||||
getWorkerPool func([]byte) (util.WorkerPool, bool)
|
|
||||||
|
|
||||||
relay func(context.Context, nodeDesc) error
|
relay func(context.Context, nodeDesc) error
|
||||||
|
|
||||||
fmt *object.FormatValidator
|
|
||||||
|
|
||||||
log *logger.Logger
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// parameters and state of container traversal.
|
// parameters and state of container traversal.
|
||||||
|
@ -137,7 +131,7 @@ func (t *distributedTarget) WriteObject(ctx context.Context, obj *objectSDK.Obje
|
||||||
|
|
||||||
var err error
|
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)
|
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)
|
withBroadcast := !prm.common.LocalOnly() && (typ == objectSDK.TypeTombstone || typ == objectSDK.TypeLock)
|
||||||
|
|
||||||
return &distributedTarget{
|
return &distributedTarget{
|
||||||
|
cfg: p.cfg,
|
||||||
traversal: traversal{
|
traversal: traversal{
|
||||||
opts: prm.traverseOpts,
|
opts: prm.traverseOpts,
|
||||||
|
|
||||||
extraBroadcastEnabled: withBroadcast,
|
extraBroadcastEnabled: withBroadcast,
|
||||||
},
|
},
|
||||||
payload: getPayload(),
|
payload: getPayload(),
|
||||||
getWorkerPool: p.getWorkerPool,
|
|
||||||
nodeTargetInitializer: func(node nodeDesc) preparedObjectTarget {
|
nodeTargetInitializer: func(node nodeDesc) preparedObjectTarget {
|
||||||
if node.local {
|
if node.local {
|
||||||
return localTarget{
|
return localTarget{
|
||||||
|
@ -240,8 +240,6 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) *distributedTarget {
|
||||||
return rt
|
return rt
|
||||||
},
|
},
|
||||||
relay: relay,
|
relay: relay,
|
||||||
fmt: p.fmtValidator,
|
|
||||||
log: p.log,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,9 +277,9 @@ func (p *Streamer) Close(ctx context.Context) (*PutResponse, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Streamer) getWorkerPool(pub []byte) (pkgutil.WorkerPool, bool) {
|
func (c *cfg) getWorkerPool(pub []byte) (pkgutil.WorkerPool, bool) {
|
||||||
if p.netmapKeys.IsLocalKey(pub) {
|
if c.netmapKeys.IsLocalKey(pub) {
|
||||||
return p.localPool, true
|
return c.localPool, true
|
||||||
}
|
}
|
||||||
return p.remotePool, false
|
return c.remotePool, false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue