Documentation ¶
Overview ¶
Package subnetid provides primitives to work with subnet identification in FrostFS.
ID type is used for global subnet identity inside the FrostFS network.
Using package types in an application is recommended to potentially work with different protocol versions with which these types are compatible.
Index ¶
- func IsZero(id ID) bool
- func MakeZero(id *ID)
- type ID
- func (x *ID) DecodeString(s string) error
- func (x ID) EncodeToString() string
- func (x ID) Equals(x2 ID) bool
- func (x ID) Marshal() []byte
- func (x *ID) ReadFromV2(msg refs.SubnetID) error
- func (x *ID) SetNumeric(num uint32)
- func (x ID) String() string
- func (x *ID) Unmarshal(data []byte) error
- func (x ID) WriteToV2(msg *refs.SubnetID)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID represents unique identifier of the subnet in the FrostFS network.
ID is mutually compatible with github.com/TrueCloudLab/frostfs-api-go/v2/refs.SubnetID message. See ReadFromV2 / WriteToV2 methods.
Instances can be created using built-in var declaration. Zero value is equivalent to identifier of the zero subnet (whole FrostFS network).
func (*ID) DecodeString ¶
DecodeString decodes string calculated using EncodeToString. Returns an error if s is malformed.
func (ID) EncodeToString ¶
EncodeToString encodes ID into FrostFS API protocol string (base10 encoding).
See also DecodeString.
func (ID) Equals ¶
Equals defines a comparison relation between two ID instances.
Note that comparison using '==' operator is not recommended since it MAY result in loss of compatibility.
func (ID) Marshal ¶
Marshal encodes ID into a binary format of the FrostFS API protocol (Protocol Buffers with direct field order).
See also Unmarshal.
func (*ID) ReadFromV2 ¶
ReadFromV2 reads ID from the refs.SubnetID message. Checks if the message conforms to FrostFS API V2 protocol.
See also WriteToV2.
func (*ID) SetNumeric ¶
SetNumeric sets ID value in numeric format. By default, number is 0 which refers to the zero subnet.
func (ID) String ¶
String implements fmt.Stringer.
String is designed to be human-readable, and its format MAY differ between SDK versions. String MAY return same result as EncodeToString. String MUST NOT be used to encode ID into FrostFS protocol string.