// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v3.19.4
// source: rbd.proto

package pb

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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	Rbdkv_Execute_FullMethodName      = "/rbdkv.Rbdkv/Execute"
	Rbdkv_Watch_FullMethodName        = "/rbdkv.Rbdkv/Watch"
	Rbdkv_LeaderInfo_FullMethodName   = "/rbdkv.Rbdkv/LeaderInfo"
	Rbdkv_ClusterStats_FullMethodName = "/rbdkv.Rbdkv/ClusterStats"
	Rbdkv_Join_FullMethodName         = "/rbdkv.Rbdkv/Join"
)

// RbdkvClient is the client API for Rbdkv 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 RbdkvClient interface {
	Execute(ctx context.Context, in *Command, opts ...grpc.CallOption) (*CommandResponse, error)
	Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchResponse], error)
	LeaderInfo(ctx context.Context, in *LeaderRequest, opts ...grpc.CallOption) (*LeaderInfoResponse, error)
	ClusterStats(ctx context.Context, in *ClusterStatsRequest, opts ...grpc.CallOption) (*ClusterStatsResponse, error)
	Join(ctx context.Context, in *JoinRequest, opts ...grpc.CallOption) (*JoinResponse, error)
}

type rbdkvClient struct {
	cc grpc.ClientConnInterface
}

func NewRbdkvClient(cc grpc.ClientConnInterface) RbdkvClient {
	return &rbdkvClient{cc}
}

func (c *rbdkvClient) Execute(ctx context.Context, in *Command, opts ...grpc.CallOption) (*CommandResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(CommandResponse)
	err := c.cc.Invoke(ctx, Rbdkv_Execute_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *rbdkvClient) Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Rbdkv_ServiceDesc.Streams[0], Rbdkv_Watch_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[WatchRequest, WatchResponse]{ClientStream: 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
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Rbdkv_WatchClient = grpc.ServerStreamingClient[WatchResponse]

func (c *rbdkvClient) LeaderInfo(ctx context.Context, in *LeaderRequest, opts ...grpc.CallOption) (*LeaderInfoResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(LeaderInfoResponse)
	err := c.cc.Invoke(ctx, Rbdkv_LeaderInfo_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *rbdkvClient) ClusterStats(ctx context.Context, in *ClusterStatsRequest, opts ...grpc.CallOption) (*ClusterStatsResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ClusterStatsResponse)
	err := c.cc.Invoke(ctx, Rbdkv_ClusterStats_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *rbdkvClient) Join(ctx context.Context, in *JoinRequest, opts ...grpc.CallOption) (*JoinResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(JoinResponse)
	err := c.cc.Invoke(ctx, Rbdkv_Join_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// RbdkvServer is the server API for Rbdkv service.
// All implementations must embed UnimplementedRbdkvServer
// for forward compatibility.
type RbdkvServer interface {
	Execute(context.Context, *Command) (*CommandResponse, error)
	Watch(*WatchRequest, grpc.ServerStreamingServer[WatchResponse]) error
	LeaderInfo(context.Context, *LeaderRequest) (*LeaderInfoResponse, error)
	ClusterStats(context.Context, *ClusterStatsRequest) (*ClusterStatsResponse, error)
	Join(context.Context, *JoinRequest) (*JoinResponse, error)
	mustEmbedUnimplementedRbdkvServer()
}

// UnimplementedRbdkvServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedRbdkvServer struct{}

func (UnimplementedRbdkvServer) Execute(context.Context, *Command) (*CommandResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Execute not implemented")
}
func (UnimplementedRbdkvServer) Watch(*WatchRequest, grpc.ServerStreamingServer[WatchResponse]) error {
	return status.Errorf(codes.Unimplemented, "method Watch not implemented")
}
func (UnimplementedRbdkvServer) LeaderInfo(context.Context, *LeaderRequest) (*LeaderInfoResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method LeaderInfo not implemented")
}
func (UnimplementedRbdkvServer) ClusterStats(context.Context, *ClusterStatsRequest) (*ClusterStatsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ClusterStats not implemented")
}
func (UnimplementedRbdkvServer) Join(context.Context, *JoinRequest) (*JoinResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Join not implemented")
}
func (UnimplementedRbdkvServer) mustEmbedUnimplementedRbdkvServer() {}
func (UnimplementedRbdkvServer) testEmbeddedByValue()               {}

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

func RegisterRbdkvServer(s grpc.ServiceRegistrar, srv RbdkvServer) {
	// If the following call pancis, it indicates UnimplementedRbdkvServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&Rbdkv_ServiceDesc, srv)
}

func _Rbdkv_Execute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Command)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(RbdkvServer).Execute(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Rbdkv_Execute_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(RbdkvServer).Execute(ctx, req.(*Command))
	}
	return interceptor(ctx, in, info, handler)
}

func _Rbdkv_Watch_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(WatchRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(RbdkvServer).Watch(m, &grpc.GenericServerStream[WatchRequest, WatchResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Rbdkv_WatchServer = grpc.ServerStreamingServer[WatchResponse]

func _Rbdkv_LeaderInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(LeaderRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(RbdkvServer).LeaderInfo(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Rbdkv_LeaderInfo_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(RbdkvServer).LeaderInfo(ctx, req.(*LeaderRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Rbdkv_ClusterStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ClusterStatsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(RbdkvServer).ClusterStats(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Rbdkv_ClusterStats_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(RbdkvServer).ClusterStats(ctx, req.(*ClusterStatsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Rbdkv_Join_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(JoinRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(RbdkvServer).Join(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Rbdkv_Join_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(RbdkvServer).Join(ctx, req.(*JoinRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Rbdkv_ServiceDesc is the grpc.ServiceDesc for Rbdkv service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Rbdkv_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "rbdkv.Rbdkv",
	HandlerType: (*RbdkvServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Execute",
			Handler:    _Rbdkv_Execute_Handler,
		},
		{
			MethodName: "LeaderInfo",
			Handler:    _Rbdkv_LeaderInfo_Handler,
		},
		{
			MethodName: "ClusterStats",
			Handler:    _Rbdkv_ClusterStats_Handler,
		},
		{
			MethodName: "Join",
			Handler:    _Rbdkv_Join_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Watch",
			Handler:       _Rbdkv_Watch_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "rbd.proto",
}
