forked from TrueCloudLab/frostfs-node
[#6] services/object: Reduce distibutedTarget
memory footprint
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
82f84662e5
commit
f762855a5d
2 changed files with 12 additions and 18 deletions
|
@ -23,8 +23,6 @@ type preparedObjectTarget interface {
|
||||||
type distributedTarget struct {
|
type distributedTarget struct {
|
||||||
traversal traversal
|
traversal traversal
|
||||||
|
|
||||||
remotePool, localPool util.WorkerPool
|
|
||||||
|
|
||||||
obj *objectSDK.Object
|
obj *objectSDK.Object
|
||||||
objMeta object.ContentMeta
|
objMeta object.ContentMeta
|
||||||
|
|
||||||
|
@ -32,7 +30,7 @@ type distributedTarget struct {
|
||||||
|
|
||||||
nodeTargetInitializer func(nodeDesc) preparedObjectTarget
|
nodeTargetInitializer func(nodeDesc) preparedObjectTarget
|
||||||
|
|
||||||
isLocalKey func([]byte) bool
|
getWorkerPool func([]byte) (util.WorkerPool, bool)
|
||||||
|
|
||||||
relay func(nodeDesc) error
|
relay func(nodeDesc) error
|
||||||
|
|
||||||
|
@ -195,16 +193,7 @@ loop:
|
||||||
|
|
||||||
addr := addrs[i]
|
addr := addrs[i]
|
||||||
|
|
||||||
isLocal := t.isLocalKey(addr.PublicKey())
|
workerPool, isLocal := t.getWorkerPool(addr.PublicKey())
|
||||||
|
|
||||||
var workerPool util.WorkerPool
|
|
||||||
|
|
||||||
if isLocal {
|
|
||||||
workerPool = t.localPool
|
|
||||||
} else {
|
|
||||||
workerPool = t.remotePool
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := workerPool.Submit(func() {
|
if err := workerPool.Submit(func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"github.com/TrueCloudLab/frostfs-node/pkg/services/object/util"
|
"github.com/TrueCloudLab/frostfs-node/pkg/services/object/util"
|
||||||
"github.com/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement"
|
"github.com/TrueCloudLab/frostfs-node/pkg/services/object_manager/placement"
|
||||||
"github.com/TrueCloudLab/frostfs-node/pkg/services/object_manager/transformer"
|
"github.com/TrueCloudLab/frostfs-node/pkg/services/object_manager/transformer"
|
||||||
|
pkgutil "github.com/TrueCloudLab/frostfs-node/pkg/util"
|
||||||
containerSDK "github.com/TrueCloudLab/frostfs-sdk-go/container"
|
containerSDK "github.com/TrueCloudLab/frostfs-sdk-go/container"
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/object"
|
"github.com/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
"github.com/TrueCloudLab/frostfs-sdk-go/user"
|
"github.com/TrueCloudLab/frostfs-sdk-go/user"
|
||||||
|
@ -216,8 +217,7 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget {
|
||||||
extraBroadcastEnabled: withBroadcast,
|
extraBroadcastEnabled: withBroadcast,
|
||||||
},
|
},
|
||||||
payload: getPayload(),
|
payload: getPayload(),
|
||||||
remotePool: p.remotePool,
|
getWorkerPool: p.getWorkerPool,
|
||||||
localPool: p.localPool,
|
|
||||||
nodeTargetInitializer: func(node nodeDesc) preparedObjectTarget {
|
nodeTargetInitializer: func(node nodeDesc) preparedObjectTarget {
|
||||||
if node.local {
|
if node.local {
|
||||||
return &localTarget{
|
return &localTarget{
|
||||||
|
@ -239,8 +239,6 @@ func (p *Streamer) newCommonTarget(prm *PutInitPrm) transformer.ObjectTarget {
|
||||||
relay: relay,
|
relay: relay,
|
||||||
fmt: p.fmtValidator,
|
fmt: p.fmtValidator,
|
||||||
log: p.log,
|
log: p.log,
|
||||||
|
|
||||||
isLocalKey: p.netmapKeys.IsLocalKey,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,3 +275,10 @@ func (p *Streamer) Close() (*PutResponse, error) {
|
||||||
id: ids.SelfID(),
|
id: ids.SelfID(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Streamer) getWorkerPool(pub []byte) (pkgutil.WorkerPool, bool) {
|
||||||
|
if p.netmapKeys.IsLocalKey(pub) {
|
||||||
|
return p.localPool, true
|
||||||
|
}
|
||||||
|
return p.remotePool, false
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue