2020-12-02 23:45:25 +00:00
|
|
|
package getsvc
|
|
|
|
|
|
|
|
import (
|
2021-05-18 08:12:51 +00:00
|
|
|
"errors"
|
|
|
|
|
2020-12-02 23:45:25 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/core/object"
|
2021-11-10 07:08:33 +00:00
|
|
|
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
|
2020-12-02 23:45:25 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (exec *execCtx) executeLocal() {
|
|
|
|
var err error
|
|
|
|
|
2020-12-09 10:32:33 +00:00
|
|
|
exec.collectedObject, err = exec.svc.localStorage.get(exec)
|
2020-12-02 23:45:25 +00:00
|
|
|
|
|
|
|
var errSplitInfo *objectSDK.SplitInfoError
|
|
|
|
|
|
|
|
switch {
|
|
|
|
default:
|
|
|
|
exec.status = statusUndefined
|
|
|
|
exec.err = err
|
|
|
|
|
|
|
|
exec.log.Debug("local get failed",
|
|
|
|
zap.String("error", err.Error()),
|
|
|
|
)
|
|
|
|
case err == nil:
|
|
|
|
exec.status = statusOK
|
|
|
|
exec.err = nil
|
|
|
|
exec.writeCollectedObject()
|
|
|
|
case errors.Is(err, object.ErrAlreadyRemoved):
|
|
|
|
exec.status = statusINHUMED
|
|
|
|
exec.err = object.ErrAlreadyRemoved
|
|
|
|
case errors.As(err, &errSplitInfo):
|
|
|
|
exec.status = statusVIRTUAL
|
|
|
|
mergeSplitInfo(exec.splitInfo(), errSplitInfo.SplitInfo())
|
|
|
|
exec.err = objectSDK.NewSplitInfoError(exec.infoSplit)
|
2020-12-07 17:49:47 +00:00
|
|
|
case errors.Is(err, object.ErrRangeOutOfBounds):
|
|
|
|
exec.status = statusOutOfRange
|
|
|
|
exec.err = object.ErrRangeOutOfBounds
|
2020-12-02 23:45:25 +00:00
|
|
|
}
|
|
|
|
}
|