forked from TrueCloudLab/frostfs-node
Dmitrii Stepanov
fc383ea6ae
Now EC objects assembling is performed concurrently. Also fixed issue with an error in case of getting EC object via non-container node. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
package getsvc
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func (r *request) executeLocal(ctx context.Context) {
|
|
ctx, span := tracing.StartSpanFromContext(ctx, "getService.executeLocal")
|
|
defer func() {
|
|
span.End()
|
|
}()
|
|
|
|
var err error
|
|
|
|
r.collectedObject, err = r.get(ctx)
|
|
|
|
var errSplitInfo *objectSDK.SplitInfoError
|
|
var errECInfo *objectSDK.ECInfoError
|
|
var errRemoved *apistatus.ObjectAlreadyRemoved
|
|
var errOutOfRange *apistatus.ObjectOutOfRange
|
|
|
|
switch {
|
|
default:
|
|
r.status = statusUndefined
|
|
r.err = err
|
|
|
|
r.log.Debug(logs.GetLocalGetFailed, zap.Error(err))
|
|
case err == nil:
|
|
r.status = statusOK
|
|
r.err = nil
|
|
r.writeCollectedObject(ctx)
|
|
case errors.As(err, &errRemoved):
|
|
r.status = statusINHUMED
|
|
r.err = errRemoved
|
|
case errors.As(err, &errSplitInfo):
|
|
r.status = statusVIRTUAL
|
|
mergeSplitInfo(r.splitInfo(), errSplitInfo.SplitInfo())
|
|
r.err = objectSDK.NewSplitInfoError(r.infoSplit)
|
|
case errors.As(err, &errECInfo):
|
|
r.status = statusEC
|
|
r.err = r.infoEC.addLocal(errECInfo.ECInfo())
|
|
case errors.As(err, &errOutOfRange):
|
|
r.status = statusOutOfRange
|
|
r.err = errOutOfRange
|
|
}
|
|
}
|
|
|
|
func (r *request) get(ctx context.Context) (*objectSDK.Object, error) {
|
|
if r.headOnly() {
|
|
return r.localStorage.Head(ctx, r.address(), r.isRaw())
|
|
}
|
|
if rng := r.ctxRange(); rng != nil {
|
|
return r.localStorage.Range(ctx, r.address(), rng)
|
|
}
|
|
return r.localStorage.Get(ctx, r.address())
|
|
}
|