forked from TrueCloudLab/frostfs-node
[#1247] object: Return NOT_FOUND
and ALREADY_REMOVED
statuses
Replace `ErrNotFound`/`ErrAlreadyRemoved` error from `pkg/core/object` package with `ObjectNotFound`/`ObjectAlreadyRemoved` one from `apistatus` package. These errors are returned by storage node's server as NeoFS API statuses. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
f32c9670ad
commit
70ffdf3478
49 changed files with 348 additions and 178 deletions
|
@ -148,8 +148,8 @@ func (x GetObjectRes) Object() *object.Object {
|
|||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
// Returns:
|
||||
// error of type *object.SplitInfoError if object if raw flag is set and requested object is virtual;
|
||||
// object.ErrAlreadyRemoved error if requested object is marked to be removed.
|
||||
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual;
|
||||
// error of type *apistatus.ObjectAlreadyRemoved if requested object is marked to be removed.
|
||||
func GetObject(prm GetObjectPrm) (*GetObjectRes, error) {
|
||||
if prm.tokenSession != nil {
|
||||
prm.cliPrm.WithinSession(*prm.tokenSession)
|
||||
|
@ -193,8 +193,6 @@ func GetObject(prm GetObjectPrm) (*GetObjectRes, error) {
|
|||
return nil, fmt.Errorf("read payload: %w", err)
|
||||
}
|
||||
|
||||
// FIXME: #1158 object.ErrAlreadyRemoved never returns
|
||||
|
||||
obj.SetPayload(buf)
|
||||
|
||||
return &GetObjectRes{
|
||||
|
@ -245,8 +243,8 @@ func (x HeadObjectRes) Header() *object.Object {
|
|||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
// Returns:
|
||||
// error of type *object.SplitInfoError if object if raw flag is set and requested object is virtual;
|
||||
// object.ErrAlreadyRemoved error if requested object is marked to be removed.
|
||||
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual;
|
||||
// error of type *apistatus.ObjectAlreadyRemoved if requested object is marked to be removed.
|
||||
func HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) {
|
||||
if prm.local {
|
||||
prm.cliPrm.MarkLocal()
|
||||
|
@ -272,8 +270,6 @@ func HeadObject(prm HeadObjectPrm) (*HeadObjectRes, error) {
|
|||
return nil, fmt.Errorf("read object header from NeoFS: %w", err)
|
||||
}
|
||||
|
||||
// FIXME: #1158 object.ErrAlreadyRemoved never returns
|
||||
|
||||
var hdr object.Object
|
||||
|
||||
if !cliRes.ReadHeader(&hdr) {
|
||||
|
@ -338,8 +334,8 @@ func (x PayloadRangeRes) PayloadRange() []byte {
|
|||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
// Returns:
|
||||
// error of type *object.SplitInfoError if object if raw flag is set and requested object is virtual;
|
||||
// object.ErrAlreadyRemoved error if requested object is marked to be removed.
|
||||
// error of type *object.SplitInfoError if object raw flag is set and requested object is virtual;
|
||||
// error of type *apistatus.ObjectAlreadyRemoved if requested object is marked to be removed.
|
||||
func PayloadRange(prm PayloadRangePrm) (*PayloadRangeRes, error) {
|
||||
if prm.local {
|
||||
prm.cliPrm.MarkLocal()
|
||||
|
@ -368,8 +364,6 @@ func PayloadRange(prm PayloadRangePrm) (*PayloadRangeRes, error) {
|
|||
return nil, fmt.Errorf("read payload: %w", err)
|
||||
}
|
||||
|
||||
// FIXME: #1158 object.ErrAlreadyRemoved never returns
|
||||
|
||||
return &PayloadRangeRes{
|
||||
data: data,
|
||||
}, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue