2022-03-17 08:03:58 +00:00
|
|
|
package shard
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
2022-12-23 17:35:35 +00:00
|
|
|
meta "github.com/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
|
|
|
|
apistatus "github.com/TrueCloudLab/frostfs-sdk-go/client/status"
|
2022-03-17 08:03:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// IsErrNotFound checks if error returned by Shard Get/Head/GetRange method
|
|
|
|
// corresponds to missing object.
|
|
|
|
func IsErrNotFound(err error) bool {
|
|
|
|
return errors.As(err, new(apistatus.ObjectNotFound))
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsErrRemoved checks if error returned by Shard Exists/Get/Head/GetRange method
|
|
|
|
// corresponds to removed object.
|
|
|
|
func IsErrRemoved(err error) bool {
|
|
|
|
return errors.As(err, new(apistatus.ObjectAlreadyRemoved))
|
|
|
|
}
|
2022-06-29 17:33:48 +00:00
|
|
|
|
|
|
|
// IsErrOutOfRange checks if an error returned by Shard GetRange method
|
|
|
|
// corresponds to exceeding the object bounds.
|
|
|
|
func IsErrOutOfRange(err error) bool {
|
|
|
|
return errors.As(err, new(apistatus.ObjectOutOfRange))
|
|
|
|
}
|
2022-07-27 18:38:28 +00:00
|
|
|
|
|
|
|
// IsErrObjectExpired checks if an error returned by Shard corresponds to
|
|
|
|
// expired object.
|
|
|
|
func IsErrObjectExpired(err error) bool {
|
2022-10-31 07:08:30 +00:00
|
|
|
return errors.Is(err, meta.ErrObjectIsExpired)
|
2022-07-27 18:38:28 +00:00
|
|
|
}
|