package getsvc import ( "context" "errors" "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs" apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status" "go.uber.org/zap" ) func (r *request) assembleEC(ctx context.Context) { if r.isRaw() { r.log.Debug(logs.GetCanNotAssembleTheObject) return } // Any access tokens are not expected to be used in the assembly process: // - there is no requirement to specify child objects in session/bearer // token for `GET`/`GETRANGE`/`RANGEHASH` requests in the API protocol, // and, therefore, their missing in the original request should not be // considered as error; on the other hand, without session for every child // object, it is impossible to attach bearer token in the new generated // requests correctly because the token has not been issued for that node's // key; // - the assembly process is expected to be handled on a container node // only since the requests forwarding mechanism presentation; such the // node should have enough rights for getting any child object by design. r.prm.common.ForgetTokens() // Do not use forwarding during assembly stage. // Request forwarding closure inherited in produced // `execCtx` so it should be disabled there. r.disableForwarding() r.log.Debug(logs.GetTryingToAssembleTheECObject) r.prm.common = r.prm.common.WithLocalOnly(false) assembler := newAssemblerEC(r.address(), r.infoEC, r.ctxRange(), r, r.containerSource, r.log) r.log.Debug(logs.GetAssemblingECObject, zap.Stringer("address", r.address()), zap.Uint64("range_offset", r.ctxRange().GetOffset()), zap.Uint64("range_length", r.ctxRange().GetLength()), ) defer r.log.Debug(logs.GetAssemblingECObjectCompleted, zap.Stringer("address", r.address()), zap.Uint64("range_offset", r.ctxRange().GetOffset()), zap.Uint64("range_length", r.ctxRange().GetLength()), ) obj, err := assembler.Assemble(ctx, r.prm.objWriter, r.headOnly()) if err != nil { r.log.Warn(logs.GetFailedToAssembleECObject, zap.Error(err), zap.Stringer("address", r.address()), zap.Uint64("range_offset", r.ctxRange().GetOffset()), zap.Uint64("range_length", r.ctxRange().GetLength()), ) } var errRemoved *apistatus.ObjectAlreadyRemoved var errOutOfRange *apistatus.ObjectOutOfRange switch { default: r.status = statusUndefined r.err = err case err == nil: r.status = statusOK r.err = nil r.collectedObject = obj case errors.As(err, &errRemoved): r.status = statusINHUMED r.err = errRemoved case errors.As(err, &errOutOfRange): r.status = statusOutOfRange r.err = errOutOfRange } }