// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             (unknown)
// source: p2p/v1/service.proto

package p2pv1

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

// 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

// P2PServiceClient is the client API for P2PService 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 P2PServiceClient interface {
	BroadcastMsg(ctx context.Context, in *BroadCastRequest, opts ...grpc.CallOption) (*BroadCastResponse, error)
	BroadcastTxsMsg(ctx context.Context, in *BroadCastTxsRequest, opts ...grpc.CallOption) (*BroadCastTxsResponse, error)
	BatchTxsmsg(ctx context.Context, in *BatchTxsHashRequest, opts ...grpc.CallOption) (*BatchTxsHashResponse, error)
	SendMsg(ctx context.Context, in *SendDataRequest, opts ...grpc.CallOption) (*SendDataResponse, error)
	SubscribeMsg(ctx context.Context, in *SubscribeMsgRequest, opts ...grpc.CallOption) (*SubscribeMsgResponse, error)
	// network info service
	NetPeerCount(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NetPeerCountResponse, error)
	NetVersion(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NetVersionResponse, error)
}

type p2PServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewP2PServiceClient(cc grpc.ClientConnInterface) P2PServiceClient {
	return &p2PServiceClient{cc}
}

func (c *p2PServiceClient) BroadcastMsg(ctx context.Context, in *BroadCastRequest, opts ...grpc.CallOption) (*BroadCastResponse, error) {
	out := new(BroadCastResponse)
	err := c.cc.Invoke(ctx, "/p2p.v1.P2PService/BroadcastMsg", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *p2PServiceClient) BroadcastTxsMsg(ctx context.Context, in *BroadCastTxsRequest, opts ...grpc.CallOption) (*BroadCastTxsResponse, error) {
	out := new(BroadCastTxsResponse)
	err := c.cc.Invoke(ctx, "/p2p.v1.P2PService/BroadcastTxsMsg", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *p2PServiceClient) BatchTxsmsg(ctx context.Context, in *BatchTxsHashRequest, opts ...grpc.CallOption) (*BatchTxsHashResponse, error) {
	out := new(BatchTxsHashResponse)
	err := c.cc.Invoke(ctx, "/p2p.v1.P2PService/BatchTxsmsg", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *p2PServiceClient) SendMsg(ctx context.Context, in *SendDataRequest, opts ...grpc.CallOption) (*SendDataResponse, error) {
	out := new(SendDataResponse)
	err := c.cc.Invoke(ctx, "/p2p.v1.P2PService/SendMsg", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *p2PServiceClient) SubscribeMsg(ctx context.Context, in *SubscribeMsgRequest, opts ...grpc.CallOption) (*SubscribeMsgResponse, error) {
	out := new(SubscribeMsgResponse)
	err := c.cc.Invoke(ctx, "/p2p.v1.P2PService/SubscribeMsg", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *p2PServiceClient) NetPeerCount(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NetPeerCountResponse, error) {
	out := new(NetPeerCountResponse)
	err := c.cc.Invoke(ctx, "/p2p.v1.P2PService/NetPeerCount", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *p2PServiceClient) NetVersion(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NetVersionResponse, error) {
	out := new(NetVersionResponse)
	err := c.cc.Invoke(ctx, "/p2p.v1.P2PService/NetVersion", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// P2PServiceServer is the server API for P2PService service.
// All implementations must embed UnimplementedP2PServiceServer
// for forward compatibility
type P2PServiceServer interface {
	BroadcastMsg(context.Context, *BroadCastRequest) (*BroadCastResponse, error)
	BroadcastTxsMsg(context.Context, *BroadCastTxsRequest) (*BroadCastTxsResponse, error)
	BatchTxsmsg(context.Context, *BatchTxsHashRequest) (*BatchTxsHashResponse, error)
	SendMsg(context.Context, *SendDataRequest) (*SendDataResponse, error)
	SubscribeMsg(context.Context, *SubscribeMsgRequest) (*SubscribeMsgResponse, error)
	// network info service
	NetPeerCount(context.Context, *emptypb.Empty) (*NetPeerCountResponse, error)
	NetVersion(context.Context, *emptypb.Empty) (*NetVersionResponse, error)
	mustEmbedUnimplementedP2PServiceServer()
}

// UnimplementedP2PServiceServer must be embedded to have forward compatible implementations.
type UnimplementedP2PServiceServer struct {
}

func (UnimplementedP2PServiceServer) BroadcastMsg(context.Context, *BroadCastRequest) (*BroadCastResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method BroadcastMsg not implemented")
}
func (UnimplementedP2PServiceServer) BroadcastTxsMsg(context.Context, *BroadCastTxsRequest) (*BroadCastTxsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method BroadcastTxsMsg not implemented")
}
func (UnimplementedP2PServiceServer) BatchTxsmsg(context.Context, *BatchTxsHashRequest) (*BatchTxsHashResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method BatchTxsmsg not implemented")
}
func (UnimplementedP2PServiceServer) SendMsg(context.Context, *SendDataRequest) (*SendDataResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SendMsg not implemented")
}
func (UnimplementedP2PServiceServer) SubscribeMsg(context.Context, *SubscribeMsgRequest) (*SubscribeMsgResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SubscribeMsg not implemented")
}
func (UnimplementedP2PServiceServer) NetPeerCount(context.Context, *emptypb.Empty) (*NetPeerCountResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method NetPeerCount not implemented")
}
func (UnimplementedP2PServiceServer) NetVersion(context.Context, *emptypb.Empty) (*NetVersionResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method NetVersion not implemented")
}
func (UnimplementedP2PServiceServer) mustEmbedUnimplementedP2PServiceServer() {}

// UnsafeP2PServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to P2PServiceServer will
// result in compilation errors.
type UnsafeP2PServiceServer interface {
	mustEmbedUnimplementedP2PServiceServer()
}

func RegisterP2PServiceServer(s grpc.ServiceRegistrar, srv P2PServiceServer) {
	s.RegisterService(&P2PService_ServiceDesc, srv)
}

func _P2PService_BroadcastMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(BroadCastRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(P2PServiceServer).BroadcastMsg(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/p2p.v1.P2PService/BroadcastMsg",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(P2PServiceServer).BroadcastMsg(ctx, req.(*BroadCastRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _P2PService_BroadcastTxsMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(BroadCastTxsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(P2PServiceServer).BroadcastTxsMsg(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/p2p.v1.P2PService/BroadcastTxsMsg",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(P2PServiceServer).BroadcastTxsMsg(ctx, req.(*BroadCastTxsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _P2PService_BatchTxsmsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(BatchTxsHashRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(P2PServiceServer).BatchTxsmsg(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/p2p.v1.P2PService/BatchTxsmsg",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(P2PServiceServer).BatchTxsmsg(ctx, req.(*BatchTxsHashRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _P2PService_SendMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SendDataRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(P2PServiceServer).SendMsg(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/p2p.v1.P2PService/SendMsg",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(P2PServiceServer).SendMsg(ctx, req.(*SendDataRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _P2PService_SubscribeMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SubscribeMsgRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(P2PServiceServer).SubscribeMsg(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/p2p.v1.P2PService/SubscribeMsg",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(P2PServiceServer).SubscribeMsg(ctx, req.(*SubscribeMsgRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _P2PService_NetPeerCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(emptypb.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(P2PServiceServer).NetPeerCount(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/p2p.v1.P2PService/NetPeerCount",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(P2PServiceServer).NetPeerCount(ctx, req.(*emptypb.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

func _P2PService_NetVersion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(emptypb.Empty)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(P2PServiceServer).NetVersion(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/p2p.v1.P2PService/NetVersion",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(P2PServiceServer).NetVersion(ctx, req.(*emptypb.Empty))
	}
	return interceptor(ctx, in, info, handler)
}

// P2PService_ServiceDesc is the grpc.ServiceDesc for P2PService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var P2PService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "p2p.v1.P2PService",
	HandlerType: (*P2PServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "BroadcastMsg",
			Handler:    _P2PService_BroadcastMsg_Handler,
		},
		{
			MethodName: "BroadcastTxsMsg",
			Handler:    _P2PService_BroadcastTxsMsg_Handler,
		},
		{
			MethodName: "BatchTxsmsg",
			Handler:    _P2PService_BatchTxsmsg_Handler,
		},
		{
			MethodName: "SendMsg",
			Handler:    _P2PService_SendMsg_Handler,
		},
		{
			MethodName: "SubscribeMsg",
			Handler:    _P2PService_SubscribeMsg_Handler,
		},
		{
			MethodName: "NetPeerCount",
			Handler:    _P2PService_NetPeerCount_Handler,
		},
		{
			MethodName: "NetVersion",
			Handler:    _P2PService_NetVersion_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "p2p/v1/service.proto",
}
