netmaker/grpc/node_grpc.pb.go

346 lines
12 KiB
Go
Raw Normal View History

2021-03-26 00:17:52 +08:00
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package nodepb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// NodeServiceClient is the client API for NodeService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type NodeServiceClient interface {
Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
CreateNode(ctx context.Context, in *CreateNodeReq, opts ...grpc.CallOption) (*CreateNodeRes, error)
ReadNode(ctx context.Context, in *ReadNodeReq, opts ...grpc.CallOption) (*ReadNodeRes, error)
UpdateNode(ctx context.Context, in *UpdateNodeReq, opts ...grpc.CallOption) (*UpdateNodeRes, error)
DeleteNode(ctx context.Context, in *DeleteNodeReq, opts ...grpc.CallOption) (*DeleteNodeRes, error)
GetPeers(ctx context.Context, in *GetPeersReq, opts ...grpc.CallOption) (NodeService_GetPeersClient, error)
CheckIn(ctx context.Context, in *CheckInReq, opts ...grpc.CallOption) (*CheckInRes, error)
}
type nodeServiceClient struct {
cc grpc.ClientConnInterface
}
func NewNodeServiceClient(cc grpc.ClientConnInterface) NodeServiceClient {
return &nodeServiceClient{cc}
}
func (c *nodeServiceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error) {
out := new(LoginResponse)
err := c.cc.Invoke(ctx, "/node.NodeService/Login", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *nodeServiceClient) CreateNode(ctx context.Context, in *CreateNodeReq, opts ...grpc.CallOption) (*CreateNodeRes, error) {
out := new(CreateNodeRes)
err := c.cc.Invoke(ctx, "/node.NodeService/CreateNode", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *nodeServiceClient) ReadNode(ctx context.Context, in *ReadNodeReq, opts ...grpc.CallOption) (*ReadNodeRes, error) {
out := new(ReadNodeRes)
err := c.cc.Invoke(ctx, "/node.NodeService/ReadNode", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *nodeServiceClient) UpdateNode(ctx context.Context, in *UpdateNodeReq, opts ...grpc.CallOption) (*UpdateNodeRes, error) {
out := new(UpdateNodeRes)
err := c.cc.Invoke(ctx, "/node.NodeService/UpdateNode", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *nodeServiceClient) DeleteNode(ctx context.Context, in *DeleteNodeReq, opts ...grpc.CallOption) (*DeleteNodeRes, error) {
out := new(DeleteNodeRes)
err := c.cc.Invoke(ctx, "/node.NodeService/DeleteNode", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *nodeServiceClient) GetPeers(ctx context.Context, in *GetPeersReq, opts ...grpc.CallOption) (NodeService_GetPeersClient, error) {
stream, err := c.cc.NewStream(ctx, &NodeService_ServiceDesc.Streams[0], "/node.NodeService/GetPeers", opts...)
if err != nil {
return nil, err
}
x := &nodeServiceGetPeersClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type NodeService_GetPeersClient interface {
Recv() (*GetPeersRes, error)
grpc.ClientStream
}
type nodeServiceGetPeersClient struct {
grpc.ClientStream
}
func (x *nodeServiceGetPeersClient) Recv() (*GetPeersRes, error) {
m := new(GetPeersRes)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *nodeServiceClient) CheckIn(ctx context.Context, in *CheckInReq, opts ...grpc.CallOption) (*CheckInRes, error) {
out := new(CheckInRes)
err := c.cc.Invoke(ctx, "/node.NodeService/CheckIn", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// NodeServiceServer is the server API for NodeService service.
// All implementations must embed UnimplementedNodeServiceServer
// for forward compatibility
type NodeServiceServer interface {
Login(context.Context, *LoginRequest) (*LoginResponse, error)
CreateNode(context.Context, *CreateNodeReq) (*CreateNodeRes, error)
ReadNode(context.Context, *ReadNodeReq) (*ReadNodeRes, error)
UpdateNode(context.Context, *UpdateNodeReq) (*UpdateNodeRes, error)
DeleteNode(context.Context, *DeleteNodeReq) (*DeleteNodeRes, error)
GetPeers(*GetPeersReq, NodeService_GetPeersServer) error
CheckIn(context.Context, *CheckInReq) (*CheckInRes, error)
mustEmbedUnimplementedNodeServiceServer()
}
// UnimplementedNodeServiceServer must be embedded to have forward compatible implementations.
type UnimplementedNodeServiceServer struct {
}
func (UnimplementedNodeServiceServer) Login(context.Context, *LoginRequest) (*LoginResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
}
func (UnimplementedNodeServiceServer) CreateNode(context.Context, *CreateNodeReq) (*CreateNodeRes, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateNode not implemented")
}
func (UnimplementedNodeServiceServer) ReadNode(context.Context, *ReadNodeReq) (*ReadNodeRes, error) {
return nil, status.Errorf(codes.Unimplemented, "method ReadNode not implemented")
}
func (UnimplementedNodeServiceServer) UpdateNode(context.Context, *UpdateNodeReq) (*UpdateNodeRes, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateNode not implemented")
}
func (UnimplementedNodeServiceServer) DeleteNode(context.Context, *DeleteNodeReq) (*DeleteNodeRes, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteNode not implemented")
}
func (UnimplementedNodeServiceServer) GetPeers(*GetPeersReq, NodeService_GetPeersServer) error {
return status.Errorf(codes.Unimplemented, "method GetPeers not implemented")
}
func (UnimplementedNodeServiceServer) CheckIn(context.Context, *CheckInReq) (*CheckInRes, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckIn not implemented")
}
func (UnimplementedNodeServiceServer) mustEmbedUnimplementedNodeServiceServer() {}
// UnsafeNodeServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to NodeServiceServer will
// result in compilation errors.
type UnsafeNodeServiceServer interface {
mustEmbedUnimplementedNodeServiceServer()
}
func RegisterNodeServiceServer(s grpc.ServiceRegistrar, srv NodeServiceServer) {
s.RegisterService(&NodeService_ServiceDesc, srv)
}
func _NodeService_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeServiceServer).Login(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/node.NodeService/Login",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).Login(ctx, req.(*LoginRequest))
}
return interceptor(ctx, in, info, handler)
}
func _NodeService_CreateNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateNodeReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeServiceServer).CreateNode(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/node.NodeService/CreateNode",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).CreateNode(ctx, req.(*CreateNodeReq))
}
return interceptor(ctx, in, info, handler)
}
func _NodeService_ReadNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReadNodeReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeServiceServer).ReadNode(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/node.NodeService/ReadNode",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).ReadNode(ctx, req.(*ReadNodeReq))
}
return interceptor(ctx, in, info, handler)
}
func _NodeService_UpdateNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateNodeReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeServiceServer).UpdateNode(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/node.NodeService/UpdateNode",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).UpdateNode(ctx, req.(*UpdateNodeReq))
}
return interceptor(ctx, in, info, handler)
}
func _NodeService_DeleteNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteNodeReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeServiceServer).DeleteNode(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/node.NodeService/DeleteNode",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).DeleteNode(ctx, req.(*DeleteNodeReq))
}
return interceptor(ctx, in, info, handler)
}
func _NodeService_GetPeers_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(GetPeersReq)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(NodeServiceServer).GetPeers(m, &nodeServiceGetPeersServer{stream})
}
type NodeService_GetPeersServer interface {
Send(*GetPeersRes) error
grpc.ServerStream
}
type nodeServiceGetPeersServer struct {
grpc.ServerStream
}
func (x *nodeServiceGetPeersServer) Send(m *GetPeersRes) error {
return x.ServerStream.SendMsg(m)
}
func _NodeService_CheckIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckInReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeServiceServer).CheckIn(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/node.NodeService/CheckIn",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).CheckIn(ctx, req.(*CheckInReq))
}
return interceptor(ctx, in, info, handler)
}
// NodeService_ServiceDesc is the grpc.ServiceDesc for NodeService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var NodeService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "node.NodeService",
HandlerType: (*NodeServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Login",
Handler: _NodeService_Login_Handler,
},
{
MethodName: "CreateNode",
Handler: _NodeService_CreateNode_Handler,
},
{
MethodName: "ReadNode",
Handler: _NodeService_ReadNode_Handler,
},
{
MethodName: "UpdateNode",
Handler: _NodeService_UpdateNode_Handler,
},
{
MethodName: "DeleteNode",
Handler: _NodeService_DeleteNode_Handler,
},
{
MethodName: "CheckIn",
Handler: _NodeService_CheckIn_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "GetPeers",
Handler: _NodeService_GetPeers_Handler,
ServerStreams: true,
},
},
Metadata: "grpc/node.proto",
}