forked from TrueCloudLab/frostfs-node
[#233] services/object: Implement new Get algorithm
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
26f03c6301
commit
f24daa10ff
31 changed files with 2163 additions and 355 deletions
54
pkg/services/object/get/container.go
Normal file
54
pkg/services/object/get/container.go
Normal file
|
@ -0,0 +1,54 @@
|
|||
package getsvc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func (exec *execCtx) executeOnContainer() {
|
||||
if exec.isLocal() {
|
||||
exec.log.Debug("return result directly")
|
||||
return
|
||||
}
|
||||
|
||||
exec.log.Debug("trying to execute in container...")
|
||||
|
||||
traverser, ok := exec.generateTraverser(exec.address())
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(exec.context())
|
||||
defer cancel()
|
||||
|
||||
exec.status = statusUndefined
|
||||
|
||||
loop:
|
||||
for {
|
||||
addrs := traverser.Next()
|
||||
if len(addrs) == 0 {
|
||||
exec.log.Debug("no more nodes, abort placement iteration")
|
||||
break
|
||||
}
|
||||
|
||||
for i := range addrs {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
exec.log.Debug("interrupt placement iteration by context",
|
||||
zap.String("error", ctx.Err().Error()),
|
||||
)
|
||||
break loop
|
||||
default:
|
||||
}
|
||||
|
||||
// TODO: consider parallel execution
|
||||
// TODO: consider optimization: if status == SPLIT we can continue until
|
||||
// we reach the best result - split info with linking object ID.
|
||||
if exec.processNode(ctx, addrs[i]) {
|
||||
exec.log.Debug("completing the operation")
|
||||
break loop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue