2020-12-03 02:45:25 +03:00
|
|
|
package getsvc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2021-05-18 11:12:51 +03:00
|
|
|
"errors"
|
2020-12-03 02:45:25 +03:00
|
|
|
|
2023-03-13 14:37:35 +03:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/pkg/tracing"
|
2023-04-12 17:35:10 +03:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
2023-03-07 16:38:26 +03:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
|
|
|
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
|
|
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
2020-12-03 02:45:25 +03:00
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
2021-09-28 07:46:10 +03:00
|
|
|
func (exec *execCtx) processNode(ctx context.Context, info client.NodeInfo) bool {
|
2023-03-13 14:37:35 +03:00
|
|
|
ctx, span := tracing.StartSpanFromContext(ctx, "getService.processNode")
|
|
|
|
defer span.End()
|
|
|
|
|
2023-04-13 15:51:36 +03:00
|
|
|
exec.log.Debug(logs.ProcessingNode)
|
2020-12-03 02:45:25 +03:00
|
|
|
|
2021-09-28 07:46:10 +03:00
|
|
|
client, ok := exec.remoteClient(info)
|
2020-12-03 02:45:25 +03:00
|
|
|
if !ok {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2023-03-31 14:49:40 +03:00
|
|
|
obj, err := client.getObject(ctx, exec, info)
|
2020-12-03 02:45:25 +03:00
|
|
|
|
|
|
|
var errSplitInfo *objectSDK.SplitInfoError
|
2022-03-17 11:03:58 +03:00
|
|
|
var errRemoved *apistatus.ObjectAlreadyRemoved
|
2022-06-29 20:33:48 +03:00
|
|
|
var errOutOfRange *apistatus.ObjectOutOfRange
|
2020-12-03 02:45:25 +03:00
|
|
|
|
|
|
|
switch {
|
|
|
|
default:
|
2022-03-17 11:03:58 +03:00
|
|
|
var errNotFound apistatus.ObjectNotFound
|
|
|
|
|
2020-12-03 02:45:25 +03:00
|
|
|
exec.status = statusUndefined
|
2022-03-17 11:03:58 +03:00
|
|
|
exec.err = errNotFound
|
2020-12-03 02:45:25 +03:00
|
|
|
|
2023-04-12 17:35:10 +03:00
|
|
|
exec.log.Debug(logs.GetRemoteCallFailed,
|
2020-12-03 02:45:25 +03:00
|
|
|
zap.String("error", err.Error()),
|
|
|
|
)
|
|
|
|
case err == nil:
|
|
|
|
exec.status = statusOK
|
|
|
|
exec.err = nil
|
2022-07-15 09:55:53 +03:00
|
|
|
|
|
|
|
// both object and err are nil only if the original
|
|
|
|
// request was forwarded to another node and the object
|
|
|
|
// has already been streamed to the requesting party
|
|
|
|
if obj != nil {
|
|
|
|
exec.collectedObject = obj
|
2023-03-31 14:49:40 +03:00
|
|
|
exec.writeCollectedObject(ctx)
|
2022-07-15 09:55:53 +03:00
|
|
|
}
|
2022-03-17 11:03:58 +03:00
|
|
|
case errors.As(err, &errRemoved):
|
2020-12-03 02:45:25 +03:00
|
|
|
exec.status = statusINHUMED
|
2022-03-17 11:03:58 +03:00
|
|
|
exec.err = errRemoved
|
2022-06-29 20:33:48 +03:00
|
|
|
case errors.As(err, &errOutOfRange):
|
|
|
|
exec.status = statusOutOfRange
|
|
|
|
exec.err = errOutOfRange
|
2020-12-03 02:45:25 +03:00
|
|
|
case errors.As(err, &errSplitInfo):
|
|
|
|
exec.status = statusVIRTUAL
|
|
|
|
mergeSplitInfo(exec.splitInfo(), errSplitInfo.SplitInfo())
|
|
|
|
exec.err = objectSDK.NewSplitInfoError(exec.infoSplit)
|
|
|
|
}
|
|
|
|
|
|
|
|
return exec.status != statusUndefined
|
|
|
|
}
|