[#418] netmap: Support NetmapService.NetmapSnapshot RPC

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-09-17 13:59:54 +04:00 committed by LeL
parent f3e1f8ae7a
commit cf868188ef
36 changed files with 1139 additions and 197 deletions

View file

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.21.5
// - protoc v3.21.6
// source: netmap/grpc/service.proto
package netmap
@ -40,6 +40,13 @@ type NetmapServiceClient interface {
// information about the current network state has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON).
NetworkInfo(ctx context.Context, in *NetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error)
// Returns network map snapshot of the current NeoFS epoch.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS):
// information about the current network map has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON).
NetmapSnapshot(ctx context.Context, in *NetmapSnapshotRequest, opts ...grpc.CallOption) (*NetmapSnapshotResponse, error)
}
type netmapServiceClient struct {
@ -68,6 +75,15 @@ func (c *netmapServiceClient) NetworkInfo(ctx context.Context, in *NetworkInfoRe
return out, nil
}
func (c *netmapServiceClient) NetmapSnapshot(ctx context.Context, in *NetmapSnapshotRequest, opts ...grpc.CallOption) (*NetmapSnapshotResponse, error) {
out := new(NetmapSnapshotResponse)
err := c.cc.Invoke(ctx, "/neo.fs.v2.netmap.NetmapService/NetmapSnapshot", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// NetmapServiceServer is the server API for NetmapService service.
// All implementations should embed UnimplementedNetmapServiceServer
// for forward compatibility
@ -90,6 +106,13 @@ type NetmapServiceServer interface {
// information about the current network state has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON).
NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error)
// Returns network map snapshot of the current NeoFS epoch.
//
// Statuses:
// - **OK** (0, SECTION_SUCCESS):
// information about the current network map has been successfully read;
// - Common failures (SECTION_FAILURE_COMMON).
NetmapSnapshot(context.Context, *NetmapSnapshotRequest) (*NetmapSnapshotResponse, error)
}
// UnimplementedNetmapServiceServer should be embedded to have forward compatible implementations.
@ -102,6 +125,9 @@ func (UnimplementedNetmapServiceServer) LocalNodeInfo(context.Context, *LocalNod
func (UnimplementedNetmapServiceServer) NetworkInfo(context.Context, *NetworkInfoRequest) (*NetworkInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NetworkInfo not implemented")
}
func (UnimplementedNetmapServiceServer) NetmapSnapshot(context.Context, *NetmapSnapshotRequest) (*NetmapSnapshotResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NetmapSnapshot not implemented")
}
// UnsafeNetmapServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to NetmapServiceServer will
@ -150,6 +176,24 @@ func _NetmapService_NetworkInfo_Handler(srv interface{}, ctx context.Context, de
return interceptor(ctx, in, info, handler)
}
func _NetmapService_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.(NetmapServiceServer).NetmapSnapshot(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/neo.fs.v2.netmap.NetmapService/NetmapSnapshot",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NetmapServiceServer).NetmapSnapshot(ctx, req.(*NetmapSnapshotRequest))
}
return interceptor(ctx, in, info, handler)
}
// NetmapService_ServiceDesc is the grpc.ServiceDesc for NetmapService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -165,6 +209,10 @@ var NetmapService_ServiceDesc = grpc.ServiceDesc{
MethodName: "NetworkInfo",
Handler: _NetmapService_NetworkInfo_Handler,
},
{
MethodName: "NetmapSnapshot",
Handler: _NetmapService_NetmapSnapshot_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "netmap/grpc/service.proto",