diff --git a/pkg/services/control/server/netmap_snapshot.go b/pkg/services/control/server/netmap_snapshot.go new file mode 100644 index 000000000..6643da14a --- /dev/null +++ b/pkg/services/control/server/netmap_snapshot.go @@ -0,0 +1,12 @@ +package control + +import ( + "context" + + "github.com/nspcc-dev/neofs-node/pkg/services/control" +) + +// NetmapSnapshot reads network map snapshot from Netmap storage. +func (s *Server) NetmapSnapshot(ctx context.Context, req *control.NetmapSnapshotRequest) (*control.NetmapSnapshotResponse, error) { + panic("implement me") +} diff --git a/pkg/services/control/service.go b/pkg/services/control/service.go index 874acfe48..4cde4be0d 100644 --- a/pkg/services/control/service.go +++ b/pkg/services/control/service.go @@ -58,3 +58,38 @@ func (m *HealthCheckResponse) ReadSignedData(buf []byte) ([]byte, error) { func (m *HealthCheckResponse) SignedDataSize() int { return m.GetBody().Size() } + +// SetBody sets get netmap snapshot request body. +func (m *NetmapSnapshotRequest) SetBody(v *NetmapSnapshotRequest_Body) { + if m != nil { + m.Body = v + } +} + +// SetSignature sets signature of the netmap snapshot request body. +func (m *NetmapSnapshotRequest) SetSignature(body *Signature) { + if m != nil { + m.Signature = body + } +} + +// SetNetmap sets structure of the current network map. +func (m *NetmapSnapshotResponse_Body) SetNetmap(v *Netmap) { + if m != nil { + m.Netmap = v + } +} + +// SetBody sets get netmap snapshot response body. +func (m *NetmapSnapshotResponse) SetBody(v *NetmapSnapshotResponse_Body) { + if m != nil { + m.Body = v + } +} + +// SetSignature sets signature of the get netmap snapshot response body. +func (m *NetmapSnapshotResponse) SetSignature(v *Signature) { + if m != nil { + m.Signature = v + } +} diff --git a/pkg/services/control/service.pb.go b/pkg/services/control/service.pb.go index f5810bea9..2186fc1e3 100644 --- a/pkg/services/control/service.pb.go +++ b/pkg/services/control/service.pb.go @@ -228,36 +228,250 @@ func (m *HealthCheckResponse_Body) GetStatus() HealthStatus { return HealthStatus_STATUS_UNDEFINED } +// Get netmap snapshot request. +type NetmapSnapshotRequest struct { + // Body of get netmap snapshot request message. + Body *NetmapSnapshotRequest_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Body signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NetmapSnapshotRequest) Reset() { *m = NetmapSnapshotRequest{} } +func (m *NetmapSnapshotRequest) String() string { return proto.CompactTextString(m) } +func (*NetmapSnapshotRequest) ProtoMessage() {} +func (*NetmapSnapshotRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d828cf854a991d79, []int{2} +} +func (m *NetmapSnapshotRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NetmapSnapshotRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NetmapSnapshotRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NetmapSnapshotRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetmapSnapshotRequest.Merge(m, src) +} +func (m *NetmapSnapshotRequest) XXX_Size() int { + return m.Size() +} +func (m *NetmapSnapshotRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NetmapSnapshotRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NetmapSnapshotRequest proto.InternalMessageInfo + +func (m *NetmapSnapshotRequest) GetBody() *NetmapSnapshotRequest_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *NetmapSnapshotRequest) GetSignature() *Signature { + if m != nil { + return m.Signature + } + return nil +} + +// Get netmap snapshot request body. +type NetmapSnapshotRequest_Body struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NetmapSnapshotRequest_Body) Reset() { *m = NetmapSnapshotRequest_Body{} } +func (m *NetmapSnapshotRequest_Body) String() string { return proto.CompactTextString(m) } +func (*NetmapSnapshotRequest_Body) ProtoMessage() {} +func (*NetmapSnapshotRequest_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_d828cf854a991d79, []int{2, 0} +} +func (m *NetmapSnapshotRequest_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NetmapSnapshotRequest_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NetmapSnapshotRequest_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NetmapSnapshotRequest_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetmapSnapshotRequest_Body.Merge(m, src) +} +func (m *NetmapSnapshotRequest_Body) XXX_Size() int { + return m.Size() +} +func (m *NetmapSnapshotRequest_Body) XXX_DiscardUnknown() { + xxx_messageInfo_NetmapSnapshotRequest_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_NetmapSnapshotRequest_Body proto.InternalMessageInfo + +// Get netmap snapshot request. +type NetmapSnapshotResponse struct { + // Body of get netmap snapshot response message. + Body *NetmapSnapshotResponse_Body `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` + // Body signature. + Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NetmapSnapshotResponse) Reset() { *m = NetmapSnapshotResponse{} } +func (m *NetmapSnapshotResponse) String() string { return proto.CompactTextString(m) } +func (*NetmapSnapshotResponse) ProtoMessage() {} +func (*NetmapSnapshotResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d828cf854a991d79, []int{3} +} +func (m *NetmapSnapshotResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NetmapSnapshotResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NetmapSnapshotResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NetmapSnapshotResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetmapSnapshotResponse.Merge(m, src) +} +func (m *NetmapSnapshotResponse) XXX_Size() int { + return m.Size() +} +func (m *NetmapSnapshotResponse) XXX_DiscardUnknown() { + xxx_messageInfo_NetmapSnapshotResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_NetmapSnapshotResponse proto.InternalMessageInfo + +func (m *NetmapSnapshotResponse) GetBody() *NetmapSnapshotResponse_Body { + if m != nil { + return m.Body + } + return nil +} + +func (m *NetmapSnapshotResponse) GetSignature() *Signature { + if m != nil { + return m.Signature + } + return nil +} + +// Get netmap snapshot response body +type NetmapSnapshotResponse_Body struct { + // Structure of the requested network map. + Netmap *Netmap `protobuf:"bytes,1,opt,name=netmap,proto3" json:"netmap,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NetmapSnapshotResponse_Body) Reset() { *m = NetmapSnapshotResponse_Body{} } +func (m *NetmapSnapshotResponse_Body) String() string { return proto.CompactTextString(m) } +func (*NetmapSnapshotResponse_Body) ProtoMessage() {} +func (*NetmapSnapshotResponse_Body) Descriptor() ([]byte, []int) { + return fileDescriptor_d828cf854a991d79, []int{3, 0} +} +func (m *NetmapSnapshotResponse_Body) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NetmapSnapshotResponse_Body) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NetmapSnapshotResponse_Body.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NetmapSnapshotResponse_Body) XXX_Merge(src proto.Message) { + xxx_messageInfo_NetmapSnapshotResponse_Body.Merge(m, src) +} +func (m *NetmapSnapshotResponse_Body) XXX_Size() int { + return m.Size() +} +func (m *NetmapSnapshotResponse_Body) XXX_DiscardUnknown() { + xxx_messageInfo_NetmapSnapshotResponse_Body.DiscardUnknown(m) +} + +var xxx_messageInfo_NetmapSnapshotResponse_Body proto.InternalMessageInfo + +func (m *NetmapSnapshotResponse_Body) GetNetmap() *Netmap { + if m != nil { + return m.Netmap + } + return nil +} + func init() { proto.RegisterType((*HealthCheckRequest)(nil), "control.HealthCheckRequest") proto.RegisterType((*HealthCheckRequest_Body)(nil), "control.HealthCheckRequest.Body") proto.RegisterType((*HealthCheckResponse)(nil), "control.HealthCheckResponse") proto.RegisterType((*HealthCheckResponse_Body)(nil), "control.HealthCheckResponse.Body") + proto.RegisterType((*NetmapSnapshotRequest)(nil), "control.NetmapSnapshotRequest") + proto.RegisterType((*NetmapSnapshotRequest_Body)(nil), "control.NetmapSnapshotRequest.Body") + proto.RegisterType((*NetmapSnapshotResponse)(nil), "control.NetmapSnapshotResponse") + proto.RegisterType((*NetmapSnapshotResponse_Body)(nil), "control.NetmapSnapshotResponse.Body") } func init() { proto.RegisterFile("pkg/services/control/service.proto", fileDescriptor_d828cf854a991d79) } var fileDescriptor_d828cf854a991d79 = []byte{ - // 291 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0xc8, 0x4e, 0xd7, - 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0x2d, 0xd6, 0x4f, 0xce, 0xcf, 0x2b, 0x29, 0xca, 0xcf, - 0x81, 0x09, 0xe8, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0xb1, 0x43, 0x85, 0xa5, 0xb8, 0x4b, 0x2a, - 0x0b, 0x52, 0x8b, 0x21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x18, 0xa2, 0x4c, 0xd2, 0x33, 0x4b, - 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xf3, 0x8a, 0x0b, 0x92, 0x93, 0x75, 0x53, 0x52, - 0xcb, 0xf4, 0xf3, 0x52, 0xf3, 0xd3, 0x8a, 0x75, 0xf3, 0xf2, 0x53, 0x52, 0xf5, 0xb1, 0x25, 0x83, - 0x24, 0x36, 0x70, 0x4c, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xbe, 0x20, 0xe7, 0x25, - 0x02, 0x00, 0x00, + // 371 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xc1, 0x4e, 0xc2, 0x40, + 0x10, 0x75, 0x0d, 0xa9, 0x71, 0x49, 0x30, 0x59, 0x83, 0x21, 0xd5, 0x54, 0xac, 0x26, 0x7a, 0xa1, + 0x35, 0x08, 0xd1, 0x33, 0x24, 0x86, 0x93, 0x89, 0xed, 0xcd, 0x5b, 0x69, 0x47, 0x4a, 0x80, 0xdd, + 0xb5, 0xbb, 0x25, 0xe1, 0xee, 0xc9, 0x2f, 0xf0, 0x27, 0x3c, 0xfa, 0x0f, 0x1e, 0xfd, 0x04, 0x83, + 0x3f, 0x62, 0x6c, 0x17, 0xb4, 0x88, 0xf5, 0x20, 0xd7, 0x99, 0x37, 0xef, 0xbd, 0x7d, 0x3b, 0x83, + 0x4d, 0x3e, 0xe8, 0xd9, 0x02, 0xa2, 0x71, 0xdf, 0x07, 0x61, 0xfb, 0x8c, 0xca, 0x88, 0x0d, 0x67, + 0x05, 0x8b, 0x47, 0x4c, 0x32, 0xb2, 0xa1, 0xca, 0x7a, 0x51, 0x4e, 0x38, 0x88, 0xb4, 0x6a, 0xde, + 0x23, 0x4c, 0x3a, 0xe0, 0x0d, 0x65, 0xd8, 0x0e, 0xc1, 0x1f, 0x38, 0x70, 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, 0x3f, 0xd2, 0x69, 0x5d, 0xbe, 0x4c, 0x0d, 0xf4, 0x3a, 0x35, 0xd0, 0xdb, 0xd4, + 0x40, 0x8f, 0xef, 0xc6, 0xda, 0x4d, 0xa3, 0xd7, 0x97, 0x61, 0xdc, 0xb5, 0x7c, 0x36, 0xb2, 0xa9, + 0xe0, 0xbe, 0x5f, 0x0b, 0x60, 0x6c, 0x53, 0x60, 0xb7, 0xa2, 0x46, 0x59, 0x00, 0xf6, 0xb2, 0xfb, + 0xec, 0x6a, 0xc9, 0x09, 0x9e, 0x7d, 0x04, 0x00, 0x00, 0xff, 0xff, 0xdd, 0xe4, 0x1e, 0xce, 0xbe, + 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -274,6 +488,8 @@ const _ = grpc.SupportPackageIsVersion4 type ControlServiceClient interface { // Performs health check of the storage node. HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) + // Returns network map snapshot of the current NeoFS epoch. + NetmapSnapshot(ctx context.Context, in *NetmapSnapshotRequest, opts ...grpc.CallOption) (*NetmapSnapshotResponse, error) } type controlServiceClient struct { @@ -293,10 +509,21 @@ func (c *controlServiceClient) HealthCheck(ctx context.Context, in *HealthCheckR return out, nil } +func (c *controlServiceClient) NetmapSnapshot(ctx context.Context, in *NetmapSnapshotRequest, opts ...grpc.CallOption) (*NetmapSnapshotResponse, error) { + out := new(NetmapSnapshotResponse) + err := c.cc.Invoke(ctx, "/control.ControlService/NetmapSnapshot", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // ControlServiceServer is the server API for ControlService service. type ControlServiceServer interface { // Performs health check of the storage node. HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) + // Returns network map snapshot of the current NeoFS epoch. + NetmapSnapshot(context.Context, *NetmapSnapshotRequest) (*NetmapSnapshotResponse, error) } func RegisterControlServiceServer(s *grpc.Server, srv ControlServiceServer) { @@ -321,6 +548,24 @@ func _ControlService_HealthCheck_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _ControlService_NetmapSnapshot_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NetmapSnapshotRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ControlServiceServer).NetmapSnapshot(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/control.ControlService/NetmapSnapshot", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ControlServiceServer).NetmapSnapshot(ctx, req.(*NetmapSnapshotRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _ControlService_serviceDesc = grpc.ServiceDesc{ ServiceName: "control.ControlService", HandlerType: (*ControlServiceServer)(nil), @@ -329,6 +574,10 @@ var _ControlService_serviceDesc = grpc.ServiceDesc{ MethodName: "HealthCheck", Handler: _ControlService_HealthCheck_Handler, }, + { + MethodName: "NetmapSnapshot", + Handler: _ControlService_NetmapSnapshot_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "pkg/services/control/service.proto", @@ -463,6 +712,140 @@ func (m *HealthCheckResponse_Body) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *NetmapSnapshotRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NetmapSnapshotRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Body != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintService(dAtA, i, uint64(m.Body.Size())) + n5, err := m.Body.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.Signature != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintService(dAtA, i, uint64(m.Signature.Size())) + n6, err := m.Signature.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *NetmapSnapshotRequest_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NetmapSnapshotRequest_Body) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *NetmapSnapshotResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NetmapSnapshotResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Body != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintService(dAtA, i, uint64(m.Body.Size())) + n7, err := m.Body.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if m.Signature != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintService(dAtA, i, uint64(m.Signature.Size())) + n8, err := m.Signature.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *NetmapSnapshotResponse_Body) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NetmapSnapshotResponse_Body) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Netmap != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintService(dAtA, i, uint64(m.Netmap.Size())) + n9, err := m.Netmap.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + func encodeVarintService(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -539,6 +922,74 @@ func (m *HealthCheckResponse_Body) Size() (n int) { return n } +func (m *NetmapSnapshotRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Signature != nil { + l = m.Signature.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *NetmapSnapshotRequest_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *NetmapSnapshotResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Body != nil { + l = m.Body.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.Signature != nil { + l = m.Signature.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *NetmapSnapshotResponse_Body) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Netmap != nil { + l = m.Netmap.Size() + n += 1 + l + sovService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovService(x uint64) (n int) { for { n++ @@ -931,6 +1382,402 @@ func (m *HealthCheckResponse_Body) Unmarshal(dAtA []byte) error { } return nil } +func (m *NetmapSnapshotRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NetmapSnapshotRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NetmapSnapshotRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &NetmapSnapshotRequest_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NetmapSnapshotRequest_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NetmapSnapshotResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NetmapSnapshotResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NetmapSnapshotResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Body == nil { + m.Body = &NetmapSnapshotResponse_Body{} + } + if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &Signature{} + } + if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NetmapSnapshotResponse_Body) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Body: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Body: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Netmap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Netmap == nil { + m.Netmap = &Netmap{} + } + if err := m.Netmap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipService(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/pkg/services/control/service.proto b/pkg/services/control/service.proto index 74e4aa381..39c508cb7 100644 --- a/pkg/services/control/service.proto +++ b/pkg/services/control/service.proto @@ -10,6 +10,9 @@ option go_package = "github.com/nspcc-dev/neofs-node/pkg/services/control"; service ControlService { // Performs health check of the storage node. rpc HealthCheck (HealthCheckRequest) returns (HealthCheckResponse); + + // Returns network map snapshot of the current NeoFS epoch. + rpc NetmapSnapshot (NetmapSnapshotRequest) returns (NetmapSnapshotResponse); } // Health check request. @@ -39,3 +42,31 @@ message HealthCheckResponse { // Body signature. Signature signature = 2; } + +// Get netmap snapshot request. +message NetmapSnapshotRequest { + // Get netmap snapshot request body. + message Body { + } + + // Body of get netmap snapshot request message. + Body body = 1; + + // Body signature. + Signature signature = 2; +} + +// Get netmap snapshot request. +message NetmapSnapshotResponse { + // Get netmap snapshot response body + message Body { + // Structure of the requested network map. + Netmap netmap = 1 [json_name = "netmap"]; + } + + // Body of get netmap snapshot response message. + Body body = 1; + + // Body signature. + Signature signature = 2; +}