Documentation ¶
Index ¶
- func IsZero(id ID) bool
- func MakeZero(id *ID)
- type ID
- func (x *ID) Equals(x2 *ID) bool
- func (x *ID) FromV2(msg refs.SubnetID)
- func (x *ID) Marshal() ([]byte, error)
- func (x *ID) MarshalText() ([]byte, error)
- func (x *ID) SetNumber(num uint32)
- func (x *ID) String() string
- func (x *ID) Unmarshal(data []byte) error
- func (x *ID) UnmarshalText(text []byte) error
- func (x ID) WriteToV2(msg *refs.SubnetID)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ID ¶
ID represents NeoFS subnet identifier.
The type is compatible with the corresponding message from NeoFS API V2 protocol.
Zero value and nil pointer is equivalent to zero subnet ID.
func (*ID) Equals ¶
Equals returns true iff both instances identify the same subnet.
Method is NPE-safe: nil pointer equals to pointer to zero value.
func (*ID) FromV2 ¶
FromV2 initializes ID from refs.SubnetID message structure. Must not be called on nil.
Note: nil refs.SubnetID corresponds to zero ID value or nil pointer to it.
func (*ID) Marshal ¶
Marshal encodes ID into a binary format of NeoFS API V2 protocol (Protocol Buffers with direct field order).
func (*ID) MarshalText ¶
MarshalText encodes ID into text format according to particular NeoFS API protocol. Supported versions:
- V2 (see refs.SubnetID type).
Implements encoding.TextMarshaler.
func (*ID) SetNumber ¶
SetNumber sets ID value in uint32 format. Must not be called on nil. By default, number is 0 which refers to zero subnet.
func (*ID) String ¶
String returns string representation of ID using MarshalText. Returns string with message on error.
Implements fmt.Stringer.
func (*ID) Unmarshal ¶
Unmarshal decodes ID from NeoFS API V2 binary format (see Marshal). Must not be called on nil.
Note: empty data corresponds to zero ID value or nil pointer to it.
func (*ID) UnmarshalText ¶
UnmarshalText decodes ID from the text according to particular NeoFS API protocol. Must not be called on nil. Supported versions:
- V2 (see refs.SubnetID type).
Implements encoding.TextUnmarshaler.