forked from TrueCloudLab/frostfs-api-go
[#19] subnet: Drop related types and fields
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
bd44a3f47b
commit
ff6d8db741
23 changed files with 171 additions and 1484 deletions
|
@ -261,43 +261,3 @@ func (v *Version) StableSize() (size int) {
|
|||
func (v *Version) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(v, data, new(refs.Version))
|
||||
}
|
||||
|
||||
// SubnetID message field numbers
|
||||
const (
|
||||
_ = iota
|
||||
subnetIDValFNum
|
||||
)
|
||||
|
||||
// StableMarshal marshals SubnetID to NeoFS API V2 binary format (Protocol Buffers with direct field order).
|
||||
//
|
||||
// Returns a slice of recorded data. Data is written to the provided buffer if there is enough space.
|
||||
func (s *SubnetID) StableMarshal(buf []byte) []byte {
|
||||
if s == nil {
|
||||
return []byte{}
|
||||
}
|
||||
|
||||
if buf == nil {
|
||||
buf = make([]byte, s.StableSize())
|
||||
}
|
||||
|
||||
proto.Fixed32Marshal(subnetIDValFNum, buf, s.value)
|
||||
|
||||
return buf
|
||||
}
|
||||
|
||||
// StableSize returns the number of bytes required to write SubnetID in NeoFS API V2 binary format (see StableMarshal).
|
||||
func (s *SubnetID) StableSize() (size int) {
|
||||
if s != nil {
|
||||
size += proto.Fixed32Size(subnetIDValFNum, s.value)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Unmarshal unmarshals SubnetID from NeoFS API V2 binary format (see StableMarshal).
|
||||
// Must not be called on nil.
|
||||
//
|
||||
// Note: empty data corresponds to zero ID value or nil pointer to it.
|
||||
func (s *SubnetID) Unmarshal(data []byte) error {
|
||||
return message.Unmarshal(s, data, new(refs.SubnetID))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue