forked from TrueCloudLab/frostfs-node
[#778] services/object: Wrap last client's error into errIncompletePut
Make `errIncompletePut` to be a structure which wraps single client error. Wrap error of the last client into `errIncompletePut` during placement execution. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
02f2a98bcc
commit
61b4baf736
1 changed files with 18 additions and 5 deletions
|
@ -32,7 +32,20 @@ type distributedTarget struct {
|
||||||
log *logger.Logger
|
log *logger.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
var errIncompletePut = errors.New("incomplete object put")
|
// errIncompletePut is returned if processing on a container fails.
|
||||||
|
type errIncompletePut struct {
|
||||||
|
singleErr error // error from the last responding node
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x errIncompletePut) Error() string {
|
||||||
|
const commonMsg = "incomplete object PUT by placement"
|
||||||
|
|
||||||
|
if x.singleErr != nil {
|
||||||
|
return fmt.Sprintf("%s: %v", commonMsg, x.singleErr)
|
||||||
|
}
|
||||||
|
|
||||||
|
return commonMsg
|
||||||
|
}
|
||||||
|
|
||||||
func (t *distributedTarget) WriteHeader(obj *object.RawObject) error {
|
func (t *distributedTarget) WriteHeader(obj *object.RawObject) error {
|
||||||
t.obj = obj
|
t.obj = obj
|
||||||
|
@ -132,11 +145,11 @@ loop:
|
||||||
}
|
}
|
||||||
|
|
||||||
if !traverser.Success() {
|
if !traverser.Success() {
|
||||||
if err, ok := resErr.Load().(error); ok {
|
var err errIncompletePut
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, errIncompletePut
|
err.singleErr, _ = resErr.Load().(error)
|
||||||
|
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return new(transformer.AccessIdentifiers).
|
return new(transformer.AccessIdentifiers).
|
||||||
|
|
Loading…
Reference in a new issue