Documentation ¶
Index ¶
- Constants
- func CodeToGRPC(v Code) uint32
- func GlobalizeCommonFail(c *Code)
- func GlobalizeSuccess(c *Code)
- func IsCommonFail(c Code) bool
- func IsInSection(code Code, sec uint32) bool
- func IsSuccess(c Code) bool
- func LocalizeCommonFail(c *Code)
- func LocalizeIfInSection(c *Code, sec uint32) bool
- func LocalizeSuccess(c *Code)
- func SetStatusDetails(dst *Status, ds []Detail)
- type Code
- type Detail
- func (x *Detail) FromGRPCMessage(m grpc.Message) error
- func (x *Detail) ID() uint32
- func (x *Detail) SetID(id uint32)
- func (x *Detail) SetValue(val []byte)
- func (x *Detail) StableMarshal(buf []byte) []byte
- func (x *Detail) StableSize() (size int)
- func (x *Detail) ToGRPCMessage() grpc.Message
- func (x *Detail) Unmarshal(data []byte) error
- func (x *Detail) Value() []byte
- type Status
- func (x *Status) AppendDetails(ds ...Detail)
- func (x *Status) Code() Code
- func (x *Status) FromGRPCMessage(m grpc.Message) error
- func (x *Status) IterateDetails(f func(*Detail) bool)
- func (x *Status) Message() string
- func (x *Status) NumberOfDetails() int
- func (x *Status) ResetDetails()
- func (x *Status) SetCode(code Code)
- func (x *Status) SetMessage(msg string)
- func (x *Status) StableMarshal(buf []byte) []byte
- func (x *Status) StableSize() (size int)
- func (x *Status) ToGRPCMessage() grpc.Message
- func (x *Status) Unmarshal(data []byte) error
Constants ¶
const ( // DetailIDCorrectMagic is an identifier of details with correct network magic // which can be attached to WrongMagicNumber code. DetailIDCorrectMagic = iota )
details for WrongMagicNumber code.
Variables ¶
This section is empty.
Functions ¶
func CodeToGRPC ¶
func GlobalizeCommonFail ¶
func GlobalizeCommonFail(c *Code)
GlobalizeCommonFail globalizes the Code to the common fail section.
func GlobalizeSuccess ¶
func GlobalizeSuccess(c *Code)
GlobalizeSuccess globalizes the Code to the success section.
func IsCommonFail ¶
IsCommonFail checks if the Code is a common failure code.
func IsInSection ¶
IsInSection returns true if the Code belongs to sec-th section.
func LocalizeCommonFail ¶
func LocalizeCommonFail(c *Code)
LocalizeCommonFail localizes the Code to the common fail section.
func LocalizeIfInSection ¶
LocalizeIfInSection checks if passed global status.Code belongs to the section and:
then localizes the code and returns true, else leaves the code unchanged and returns false.
Arg must not be nil.
func LocalizeSuccess ¶
func LocalizeSuccess(c *Code)
LocalizeSuccess localizes the Code to the success section.
func SetStatusDetails ¶
SetStatusDetails sets Detail list of the Status.
Types ¶
type Code ¶
type Code uint32
Code represents NeoFS API V2-compatible status code.
const ( // Internal is a local Code value for INTERNAL failure status. Internal Code = iota // WrongMagicNumber is a local Code value for WRONG_MAGIC_NUMBER failure status. WrongMagicNumber // SignatureVerificationFail is a local Code value for SIGNATURE_VERIFICATION_FAIL status. SignatureVerificationFail // NodeUnderMaintenance is a local Code value for NODE_UNDER_MAINTENANCE status. NodeUnderMaintenance // InvalidArgument is a local Code value for INVALID_ARGUMENT status. InvalidArgument )
Common failure codes.
func CodeFromGRPC ¶
func (Code) EqualNumber ¶
EqualNumber checks if the numerical Code equals num.
func (*Code) GlobalizeSection ¶
GlobalizeSection globalizes the Code of the sec-th section.
Does not make sense if the Code is outside the section.
func (Code) InSections ¶
InSections checks if the Code is in [i,j] section list.
func (*Code) LocalizeSection ¶
LocalizeSection localizes the Code to the sec-th section.
Does not make sense if the Code is outside the section.
type Detail ¶
type Detail struct {
// contains filtered or unexported fields
}
Detail represents structure of NeoFS API V2-compatible status detail message.
func (*Detail) StableMarshal ¶
func (*Detail) StableSize ¶
func (*Detail) ToGRPCMessage ¶
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
Status represents structure of NeoFS API V2-compatible status return message.
func (*Status) AppendDetails ¶
AppendDetails appends the list of details to the Status.
func (*Status) IterateDetails ¶
IterateDetails iterates over details of the Status. Breaks iteration on f's true return.
Handler must not be nil.
func (*Status) NumberOfDetails ¶
NumberOfParameters returns number of network parameters.
func (*Status) SetMessage ¶
SetMessage sets message of the Status.