2021-01-13 13:46:39 +00:00
|
|
|
package control
|
2021-01-13 12:48:33 +00:00
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/util/proto"
|
|
|
|
)
|
|
|
|
|
|
|
|
// StableMarshal reads binary representation of health check request body
|
|
|
|
// in protobuf binary format.
|
|
|
|
//
|
|
|
|
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
|
|
//
|
|
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same binary format.
|
|
|
|
func (x *HealthCheckRequest_Body) StableMarshal(buf []byte) ([]byte, error) {
|
|
|
|
return buf, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// StableSize returns binary size of health check request body
|
|
|
|
// in protobuf binary format.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same binary size.
|
|
|
|
func (x *HealthCheckRequest_Body) StableSize() int {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2021-01-13 12:48:33 +00:00
|
|
|
// SetBody sets health check request body.
|
2021-01-15 07:39:03 +00:00
|
|
|
func (x *HealthCheckRequest) SetBody(v *HealthCheckRequest_Body) {
|
|
|
|
if x != nil {
|
|
|
|
x.Body = v
|
2021-01-13 12:48:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetSignature sets signature of the health check request body.
|
2021-01-15 07:39:03 +00:00
|
|
|
func (x *HealthCheckRequest) SetSignature(body *Signature) {
|
|
|
|
if x != nil {
|
|
|
|
x.Signature = body
|
2021-01-13 12:48:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
// ReadSignedData reads signed data of health check request to buf.
|
|
|
|
//
|
|
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
|
|
//
|
|
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same signed data.
|
|
|
|
func (x *HealthCheckRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
|
|
return x.GetBody().StableMarshal(buf)
|
2021-01-13 12:48:33 +00:00
|
|
|
}
|
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
// SignedDataSize returns binary size of the signed data
|
|
|
|
// of health check request.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same signed data size.
|
|
|
|
func (x *HealthCheckRequest) SignedDataSize() int {
|
|
|
|
return x.GetBody().StableSize()
|
2021-01-13 12:48:33 +00:00
|
|
|
}
|
|
|
|
|
2021-01-15 09:42:31 +00:00
|
|
|
// SetNetmapStatus sets status of the storage node in NeoFS network map.
|
|
|
|
func (x *HealthCheckResponse_Body) SetNetmapStatus(v NetmapStatus) {
|
2021-01-15 07:39:03 +00:00
|
|
|
if x != nil {
|
2021-01-15 09:42:31 +00:00
|
|
|
x.NetmapStatus = v
|
2021-01-13 12:48:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
const (
|
|
|
|
_ = iota
|
|
|
|
healthRespBodyStatusFNum
|
|
|
|
)
|
|
|
|
|
|
|
|
// StableMarshal reads binary representation of health check response body
|
|
|
|
// in protobuf binary format.
|
|
|
|
//
|
|
|
|
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
|
|
//
|
|
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same binary format.
|
|
|
|
func (x *HealthCheckResponse_Body) StableMarshal(buf []byte) ([]byte, error) {
|
|
|
|
if x == nil {
|
|
|
|
return []byte{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if sz := x.StableSize(); len(buf) < sz {
|
|
|
|
buf = make([]byte, sz)
|
|
|
|
}
|
|
|
|
|
2021-01-15 09:42:31 +00:00
|
|
|
_, err := proto.EnumMarshal(healthRespBodyStatusFNum, buf, int32(x.NetmapStatus))
|
2021-01-15 07:39:03 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return buf, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// StableSize returns binary size of health check response body
|
|
|
|
// in protobuf binary format.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same binary size.
|
|
|
|
func (x *HealthCheckResponse_Body) StableSize() int {
|
|
|
|
if x == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size := 0
|
|
|
|
|
2021-01-15 09:42:31 +00:00
|
|
|
size += proto.EnumSize(healthRespBodyStatusFNum, int32(x.NetmapStatus))
|
2021-01-15 07:39:03 +00:00
|
|
|
|
|
|
|
return size
|
|
|
|
}
|
|
|
|
|
2021-01-13 12:48:33 +00:00
|
|
|
// SetBody sets health check response body.
|
2021-01-15 07:39:03 +00:00
|
|
|
func (x *HealthCheckResponse) SetBody(v *HealthCheckResponse_Body) {
|
|
|
|
if x != nil {
|
|
|
|
x.Body = v
|
2021-01-13 12:48:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetSignature sets signature of the health check response body.
|
2021-01-15 07:39:03 +00:00
|
|
|
func (x *HealthCheckResponse) SetSignature(v *Signature) {
|
|
|
|
if x != nil {
|
|
|
|
x.Signature = v
|
2021-01-13 12:48:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
// ReadSignedData reads signed data of health check response to buf.
|
|
|
|
//
|
|
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
|
|
//
|
|
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same signed data.
|
|
|
|
func (x *HealthCheckResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
|
|
return x.GetBody().StableMarshal(buf)
|
|
|
|
}
|
|
|
|
|
|
|
|
// SignedDataSize returns binary size of the signed data
|
|
|
|
// of health check response.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same signed data size.
|
|
|
|
func (x *HealthCheckResponse) SignedDataSize() int {
|
|
|
|
return x.GetBody().StableSize()
|
|
|
|
}
|
2021-01-13 12:48:33 +00:00
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
// StableMarshal reads binary representation of netmap snapshot request body
|
|
|
|
// in protobuf binary format.
|
|
|
|
//
|
|
|
|
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
|
|
//
|
|
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same binary format.
|
|
|
|
func (x *NetmapSnapshotRequest_Body) StableMarshal(buf []byte) ([]byte, error) {
|
|
|
|
return buf, nil
|
2021-01-13 12:48:33 +00:00
|
|
|
}
|
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
// StableSize returns binary size of netmap snapshot request body
|
|
|
|
// in protobuf binary format.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same binary size.
|
|
|
|
func (x *NetmapSnapshotRequest_Body) StableSize() int {
|
|
|
|
return 0
|
2021-01-13 12:48:33 +00:00
|
|
|
}
|
2021-01-14 16:06:49 +00:00
|
|
|
|
|
|
|
// SetBody sets get netmap snapshot request body.
|
2021-01-15 07:39:03 +00:00
|
|
|
func (x *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) {
|
|
|
|
if x != nil {
|
|
|
|
x.Body = v
|
2021-01-14 16:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetSignature sets signature of the netmap snapshot request body.
|
2021-01-15 07:39:03 +00:00
|
|
|
func (x *NetmapSnapshotRequest) SetSignature(body *Signature) {
|
|
|
|
if x != nil {
|
|
|
|
x.Signature = body
|
2021-01-14 16:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
// ReadSignedData reads signed data of netmap snapshot request to buf.
|
|
|
|
//
|
|
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
|
|
//
|
|
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same signed data.
|
|
|
|
func (x *NetmapSnapshotRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
|
|
|
return x.GetBody().StableMarshal(buf)
|
2021-01-14 16:32:23 +00:00
|
|
|
}
|
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
// SignedDataSize returns binary size of the signed data
|
|
|
|
// of netmap snapshot request.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same signed data size.
|
|
|
|
func (x *NetmapSnapshotRequest) SignedDataSize() int {
|
|
|
|
return x.GetBody().StableSize()
|
2021-01-14 16:32:23 +00:00
|
|
|
}
|
|
|
|
|
2021-01-14 16:06:49 +00:00
|
|
|
// SetNetmap sets structure of the current network map.
|
2021-01-15 07:39:03 +00:00
|
|
|
func (x *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) {
|
|
|
|
if x != nil {
|
|
|
|
x.Netmap = v
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
|
|
|
_ = iota
|
|
|
|
snapshotRespBodyNetmapFNum
|
|
|
|
)
|
|
|
|
|
|
|
|
// StableMarshal reads binary representation of netmap snapshot response body
|
|
|
|
// in protobuf binary format.
|
|
|
|
//
|
|
|
|
// If buffer length is less than x.StableSize(), new buffer is allocated.
|
|
|
|
//
|
|
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same binary format.
|
|
|
|
func (x *NetmapSnapshotResponse_Body) StableMarshal(buf []byte) ([]byte, error) {
|
|
|
|
if x == nil {
|
|
|
|
return []byte{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
if sz := x.StableSize(); len(buf) < sz {
|
|
|
|
buf = make([]byte, sz)
|
2021-01-14 16:06:49 +00:00
|
|
|
}
|
2021-01-15 07:39:03 +00:00
|
|
|
|
|
|
|
_, err := proto.NestedStructureMarshal(snapshotRespBodyNetmapFNum, buf, x.Netmap)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return buf, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// StableSize returns binary size of netmap snapshot response body
|
|
|
|
// in protobuf binary format.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same binary size.
|
|
|
|
func (x *NetmapSnapshotResponse_Body) StableSize() int {
|
|
|
|
if x == nil {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
size := 0
|
|
|
|
|
|
|
|
size += proto.NestedStructureSize(snapshotRespBodyNetmapFNum, x.Netmap)
|
|
|
|
|
|
|
|
return size
|
2021-01-14 16:06:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetBody sets get netmap snapshot response body.
|
2021-01-15 07:39:03 +00:00
|
|
|
func (x *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) {
|
|
|
|
if x != nil {
|
|
|
|
x.Body = v
|
2021-01-14 16:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetSignature sets signature of the get netmap snapshot response body.
|
2021-01-15 07:39:03 +00:00
|
|
|
func (x *NetmapSnapshotResponse) SetSignature(v *Signature) {
|
|
|
|
if x != nil {
|
|
|
|
x.Signature = v
|
2021-01-14 16:06:49 +00:00
|
|
|
}
|
|
|
|
}
|
2021-01-14 16:32:23 +00:00
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
// ReadSignedData reads signed data of netmap snapshot response to buf.
|
|
|
|
//
|
|
|
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
|
|
|
//
|
|
|
|
// Returns any error encountered which did not allow writing the data completely.
|
|
|
|
// Otherwise, returns the buffer in which the data is written.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same signed data.
|
|
|
|
func (x *NetmapSnapshotResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
|
|
|
return x.GetBody().StableMarshal(buf)
|
2021-01-14 16:32:23 +00:00
|
|
|
}
|
|
|
|
|
2021-01-15 07:39:03 +00:00
|
|
|
// SignedDataSize returns binary size of the signed data
|
|
|
|
// of netmap snapshot response.
|
|
|
|
//
|
|
|
|
// Structures with the same field values have the same signed data size.
|
|
|
|
func (x *NetmapSnapshotResponse) SignedDataSize() int {
|
|
|
|
return x.GetBody().StableSize()
|
2021-01-14 16:32:23 +00:00
|
|
|
}
|