// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v3.21.6
// source: pkg/apis/scheduler/v2/scheduler.proto

package scheduler

import (
	context "context"
	v2 "d7y.io/api/v2/pkg/apis/common/v2"
	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

// SchedulerClient is the client API for Scheduler 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 SchedulerClient interface {
	// AnnouncePeer announces peer to scheduler.
	AnnouncePeer(ctx context.Context, opts ...grpc.CallOption) (Scheduler_AnnouncePeerClient, error)
	// Checks information of peer.
	StatPeer(ctx context.Context, in *StatPeerRequest, opts ...grpc.CallOption) (*v2.Peer, error)
	// LeavePeer releases peer in scheduler.
	LeavePeer(ctx context.Context, in *LeavePeerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// TODO exchange peer api definition.
	// ExchangePeer exchanges peer information.
	ExchangePeer(ctx context.Context, in *ExchangePeerRequest, opts ...grpc.CallOption) (*ExchangePeerResponse, error)
	// Checks information of task.
	StatTask(ctx context.Context, in *StatTaskRequest, opts ...grpc.CallOption) (*v2.Task, error)
	// AnnounceHost announces host to scheduler.
	AnnounceHost(ctx context.Context, in *AnnounceHostRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// LeaveHost releases host in scheduler.
	LeaveHost(ctx context.Context, in *LeaveHostRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// SyncProbes sync probes of the host.
	SyncProbes(ctx context.Context, opts ...grpc.CallOption) (Scheduler_SyncProbesClient, error)
}

type schedulerClient struct {
	cc grpc.ClientConnInterface
}

func NewSchedulerClient(cc grpc.ClientConnInterface) SchedulerClient {
	return &schedulerClient{cc}
}

func (c *schedulerClient) AnnouncePeer(ctx context.Context, opts ...grpc.CallOption) (Scheduler_AnnouncePeerClient, error) {
	stream, err := c.cc.NewStream(ctx, &Scheduler_ServiceDesc.Streams[0], "/scheduler.v2.Scheduler/AnnouncePeer", opts...)
	if err != nil {
		return nil, err
	}
	x := &schedulerAnnouncePeerClient{stream}
	return x, nil
}

type Scheduler_AnnouncePeerClient interface {
	Send(*AnnouncePeerRequest) error
	Recv() (*AnnouncePeerResponse, error)
	grpc.ClientStream
}

type schedulerAnnouncePeerClient struct {
	grpc.ClientStream
}

func (x *schedulerAnnouncePeerClient) Send(m *AnnouncePeerRequest) error {
	return x.ClientStream.SendMsg(m)
}

func (x *schedulerAnnouncePeerClient) Recv() (*AnnouncePeerResponse, error) {
	m := new(AnnouncePeerResponse)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *schedulerClient) StatPeer(ctx context.Context, in *StatPeerRequest, opts ...grpc.CallOption) (*v2.Peer, error) {
	out := new(v2.Peer)
	err := c.cc.Invoke(ctx, "/scheduler.v2.Scheduler/StatPeer", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *schedulerClient) LeavePeer(ctx context.Context, in *LeavePeerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	out := new(emptypb.Empty)
	err := c.cc.Invoke(ctx, "/scheduler.v2.Scheduler/LeavePeer", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *schedulerClient) ExchangePeer(ctx context.Context, in *ExchangePeerRequest, opts ...grpc.CallOption) (*ExchangePeerResponse, error) {
	out := new(ExchangePeerResponse)
	err := c.cc.Invoke(ctx, "/scheduler.v2.Scheduler/ExchangePeer", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *schedulerClient) StatTask(ctx context.Context, in *StatTaskRequest, opts ...grpc.CallOption) (*v2.Task, error) {
	out := new(v2.Task)
	err := c.cc.Invoke(ctx, "/scheduler.v2.Scheduler/StatTask", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *schedulerClient) AnnounceHost(ctx context.Context, in *AnnounceHostRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	out := new(emptypb.Empty)
	err := c.cc.Invoke(ctx, "/scheduler.v2.Scheduler/AnnounceHost", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *schedulerClient) LeaveHost(ctx context.Context, in *LeaveHostRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	out := new(emptypb.Empty)
	err := c.cc.Invoke(ctx, "/scheduler.v2.Scheduler/LeaveHost", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *schedulerClient) SyncProbes(ctx context.Context, opts ...grpc.CallOption) (Scheduler_SyncProbesClient, error) {
	stream, err := c.cc.NewStream(ctx, &Scheduler_ServiceDesc.Streams[1], "/scheduler.v2.Scheduler/SyncProbes", opts...)
	if err != nil {
		return nil, err
	}
	x := &schedulerSyncProbesClient{stream}
	return x, nil
}

type Scheduler_SyncProbesClient interface {
	Send(*SyncProbesRequest) error
	Recv() (*SyncProbesResponse, error)
	grpc.ClientStream
}

type schedulerSyncProbesClient struct {
	grpc.ClientStream
}

func (x *schedulerSyncProbesClient) Send(m *SyncProbesRequest) error {
	return x.ClientStream.SendMsg(m)
}

func (x *schedulerSyncProbesClient) Recv() (*SyncProbesResponse, error) {
	m := new(SyncProbesResponse)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// SchedulerServer is the server API for Scheduler service.
// All implementations should embed UnimplementedSchedulerServer
// for forward compatibility
type SchedulerServer interface {
	// AnnouncePeer announces peer to scheduler.
	AnnouncePeer(Scheduler_AnnouncePeerServer) error
	// Checks information of peer.
	StatPeer(context.Context, *StatPeerRequest) (*v2.Peer, error)
	// LeavePeer releases peer in scheduler.
	LeavePeer(context.Context, *LeavePeerRequest) (*emptypb.Empty, error)
	// TODO exchange peer api definition.
	// ExchangePeer exchanges peer information.
	ExchangePeer(context.Context, *ExchangePeerRequest) (*ExchangePeerResponse, error)
	// Checks information of task.
	StatTask(context.Context, *StatTaskRequest) (*v2.Task, error)
	// AnnounceHost announces host to scheduler.
	AnnounceHost(context.Context, *AnnounceHostRequest) (*emptypb.Empty, error)
	// LeaveHost releases host in scheduler.
	LeaveHost(context.Context, *LeaveHostRequest) (*emptypb.Empty, error)
	// SyncProbes sync probes of the host.
	SyncProbes(Scheduler_SyncProbesServer) error
}

// UnimplementedSchedulerServer should be embedded to have forward compatible implementations.
type UnimplementedSchedulerServer struct {
}

func (UnimplementedSchedulerServer) AnnouncePeer(Scheduler_AnnouncePeerServer) error {
	return status.Errorf(codes.Unimplemented, "method AnnouncePeer not implemented")
}
func (UnimplementedSchedulerServer) StatPeer(context.Context, *StatPeerRequest) (*v2.Peer, error) {
	return nil, status.Errorf(codes.Unimplemented, "method StatPeer not implemented")
}
func (UnimplementedSchedulerServer) LeavePeer(context.Context, *LeavePeerRequest) (*emptypb.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method LeavePeer not implemented")
}
func (UnimplementedSchedulerServer) ExchangePeer(context.Context, *ExchangePeerRequest) (*ExchangePeerResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ExchangePeer not implemented")
}
func (UnimplementedSchedulerServer) StatTask(context.Context, *StatTaskRequest) (*v2.Task, error) {
	return nil, status.Errorf(codes.Unimplemented, "method StatTask not implemented")
}
func (UnimplementedSchedulerServer) AnnounceHost(context.Context, *AnnounceHostRequest) (*emptypb.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method AnnounceHost not implemented")
}
func (UnimplementedSchedulerServer) LeaveHost(context.Context, *LeaveHostRequest) (*emptypb.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method LeaveHost not implemented")
}
func (UnimplementedSchedulerServer) SyncProbes(Scheduler_SyncProbesServer) error {
	return status.Errorf(codes.Unimplemented, "method SyncProbes not implemented")
}

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

func RegisterSchedulerServer(s grpc.ServiceRegistrar, srv SchedulerServer) {
	s.RegisterService(&Scheduler_ServiceDesc, srv)
}

func _Scheduler_AnnouncePeer_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(SchedulerServer).AnnouncePeer(&schedulerAnnouncePeerServer{stream})
}

type Scheduler_AnnouncePeerServer interface {
	Send(*AnnouncePeerResponse) error
	Recv() (*AnnouncePeerRequest, error)
	grpc.ServerStream
}

type schedulerAnnouncePeerServer struct {
	grpc.ServerStream
}

func (x *schedulerAnnouncePeerServer) Send(m *AnnouncePeerResponse) error {
	return x.ServerStream.SendMsg(m)
}

func (x *schedulerAnnouncePeerServer) Recv() (*AnnouncePeerRequest, error) {
	m := new(AnnouncePeerRequest)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _Scheduler_StatPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(StatPeerRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SchedulerServer).StatPeer(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/scheduler.v2.Scheduler/StatPeer",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SchedulerServer).StatPeer(ctx, req.(*StatPeerRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Scheduler_LeavePeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(LeavePeerRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SchedulerServer).LeavePeer(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/scheduler.v2.Scheduler/LeavePeer",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SchedulerServer).LeavePeer(ctx, req.(*LeavePeerRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Scheduler_ExchangePeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ExchangePeerRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SchedulerServer).ExchangePeer(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/scheduler.v2.Scheduler/ExchangePeer",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SchedulerServer).ExchangePeer(ctx, req.(*ExchangePeerRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Scheduler_StatTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(StatTaskRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SchedulerServer).StatTask(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/scheduler.v2.Scheduler/StatTask",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SchedulerServer).StatTask(ctx, req.(*StatTaskRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Scheduler_AnnounceHost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AnnounceHostRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SchedulerServer).AnnounceHost(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/scheduler.v2.Scheduler/AnnounceHost",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SchedulerServer).AnnounceHost(ctx, req.(*AnnounceHostRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Scheduler_LeaveHost_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(LeaveHostRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SchedulerServer).LeaveHost(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/scheduler.v2.Scheduler/LeaveHost",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SchedulerServer).LeaveHost(ctx, req.(*LeaveHostRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Scheduler_SyncProbes_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(SchedulerServer).SyncProbes(&schedulerSyncProbesServer{stream})
}

type Scheduler_SyncProbesServer interface {
	Send(*SyncProbesResponse) error
	Recv() (*SyncProbesRequest, error)
	grpc.ServerStream
}

type schedulerSyncProbesServer struct {
	grpc.ServerStream
}

func (x *schedulerSyncProbesServer) Send(m *SyncProbesResponse) error {
	return x.ServerStream.SendMsg(m)
}

func (x *schedulerSyncProbesServer) Recv() (*SyncProbesRequest, error) {
	m := new(SyncProbesRequest)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// Scheduler_ServiceDesc is the grpc.ServiceDesc for Scheduler service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Scheduler_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "scheduler.v2.Scheduler",
	HandlerType: (*SchedulerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "StatPeer",
			Handler:    _Scheduler_StatPeer_Handler,
		},
		{
			MethodName: "LeavePeer",
			Handler:    _Scheduler_LeavePeer_Handler,
		},
		{
			MethodName: "ExchangePeer",
			Handler:    _Scheduler_ExchangePeer_Handler,
		},
		{
			MethodName: "StatTask",
			Handler:    _Scheduler_StatTask_Handler,
		},
		{
			MethodName: "AnnounceHost",
			Handler:    _Scheduler_AnnounceHost_Handler,
		},
		{
			MethodName: "LeaveHost",
			Handler:    _Scheduler_LeaveHost_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "AnnouncePeer",
			Handler:       _Scheduler_AnnouncePeer_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "SyncProbes",
			Handler:       _Scheduler_SyncProbes_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "pkg/apis/scheduler/v2/scheduler.proto",
}
