// 使用的语法版本

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             v4.22.3
// source: pkgs/grpc/agent/agent.proto

package agent

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

const (
	Agent_ExecuteIOPlan_FullMethodName = "/Agent/ExecuteIOPlan"
	Agent_SendStream_FullMethodName    = "/Agent/SendStream"
	Agent_GetStream_FullMethodName     = "/Agent/GetStream"
	Agent_SendVar_FullMethodName       = "/Agent/SendVar"
	Agent_GetVar_FullMethodName        = "/Agent/GetVar"
	Agent_Ping_FullMethodName          = "/Agent/Ping"
)

// AgentClient is the client API for Agent 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 AgentClient interface {
	ExecuteIOPlan(ctx context.Context, in *ExecuteIOPlanReq, opts ...grpc.CallOption) (*ExecuteIOPlanResp, error)
	SendStream(ctx context.Context, opts ...grpc.CallOption) (Agent_SendStreamClient, error)
	GetStream(ctx context.Context, in *GetStreamReq, opts ...grpc.CallOption) (Agent_GetStreamClient, error)
	SendVar(ctx context.Context, in *SendVarReq, opts ...grpc.CallOption) (*SendVarResp, error)
	GetVar(ctx context.Context, in *GetVarReq, opts ...grpc.CallOption) (*GetVarResp, error)
	Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingResp, error)
}

type agentClient struct {
	cc grpc.ClientConnInterface
}

func NewAgentClient(cc grpc.ClientConnInterface) AgentClient {
	return &agentClient{cc}
}

func (c *agentClient) ExecuteIOPlan(ctx context.Context, in *ExecuteIOPlanReq, opts ...grpc.CallOption) (*ExecuteIOPlanResp, error) {
	out := new(ExecuteIOPlanResp)
	err := c.cc.Invoke(ctx, Agent_ExecuteIOPlan_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *agentClient) SendStream(ctx context.Context, opts ...grpc.CallOption) (Agent_SendStreamClient, error) {
	stream, err := c.cc.NewStream(ctx, &Agent_ServiceDesc.Streams[0], Agent_SendStream_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &agentSendStreamClient{stream}
	return x, nil
}

type Agent_SendStreamClient interface {
	Send(*StreamDataPacket) error
	CloseAndRecv() (*SendStreamResp, error)
	grpc.ClientStream
}

type agentSendStreamClient struct {
	grpc.ClientStream
}

func (x *agentSendStreamClient) Send(m *StreamDataPacket) error {
	return x.ClientStream.SendMsg(m)
}

func (x *agentSendStreamClient) CloseAndRecv() (*SendStreamResp, error) {
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	m := new(SendStreamResp)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *agentClient) GetStream(ctx context.Context, in *GetStreamReq, opts ...grpc.CallOption) (Agent_GetStreamClient, error) {
	stream, err := c.cc.NewStream(ctx, &Agent_ServiceDesc.Streams[1], Agent_GetStream_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &agentGetStreamClient{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 Agent_GetStreamClient interface {
	Recv() (*StreamDataPacket, error)
	grpc.ClientStream
}

type agentGetStreamClient struct {
	grpc.ClientStream
}

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

func (c *agentClient) SendVar(ctx context.Context, in *SendVarReq, opts ...grpc.CallOption) (*SendVarResp, error) {
	out := new(SendVarResp)
	err := c.cc.Invoke(ctx, Agent_SendVar_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *agentClient) GetVar(ctx context.Context, in *GetVarReq, opts ...grpc.CallOption) (*GetVarResp, error) {
	out := new(GetVarResp)
	err := c.cc.Invoke(ctx, Agent_GetVar_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *agentClient) Ping(ctx context.Context, in *PingReq, opts ...grpc.CallOption) (*PingResp, error) {
	out := new(PingResp)
	err := c.cc.Invoke(ctx, Agent_Ping_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// AgentServer is the server API for Agent service.
// All implementations must embed UnimplementedAgentServer
// for forward compatibility
type AgentServer interface {
	ExecuteIOPlan(context.Context, *ExecuteIOPlanReq) (*ExecuteIOPlanResp, error)
	SendStream(Agent_SendStreamServer) error
	GetStream(*GetStreamReq, Agent_GetStreamServer) error
	SendVar(context.Context, *SendVarReq) (*SendVarResp, error)
	GetVar(context.Context, *GetVarReq) (*GetVarResp, error)
	Ping(context.Context, *PingReq) (*PingResp, error)
	mustEmbedUnimplementedAgentServer()
}

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

func (UnimplementedAgentServer) ExecuteIOPlan(context.Context, *ExecuteIOPlanReq) (*ExecuteIOPlanResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ExecuteIOPlan not implemented")
}
func (UnimplementedAgentServer) SendStream(Agent_SendStreamServer) error {
	return status.Errorf(codes.Unimplemented, "method SendStream not implemented")
}
func (UnimplementedAgentServer) GetStream(*GetStreamReq, Agent_GetStreamServer) error {
	return status.Errorf(codes.Unimplemented, "method GetStream not implemented")
}
func (UnimplementedAgentServer) SendVar(context.Context, *SendVarReq) (*SendVarResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SendVar not implemented")
}
func (UnimplementedAgentServer) GetVar(context.Context, *GetVarReq) (*GetVarResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetVar not implemented")
}
func (UnimplementedAgentServer) Ping(context.Context, *PingReq) (*PingResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {}

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

func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) {
	s.RegisterService(&Agent_ServiceDesc, srv)
}

func _Agent_ExecuteIOPlan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ExecuteIOPlanReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).ExecuteIOPlan(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_ExecuteIOPlan_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).ExecuteIOPlan(ctx, req.(*ExecuteIOPlanReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Agent_SendStream_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(AgentServer).SendStream(&agentSendStreamServer{stream})
}

type Agent_SendStreamServer interface {
	SendAndClose(*SendStreamResp) error
	Recv() (*StreamDataPacket, error)
	grpc.ServerStream
}

type agentSendStreamServer struct {
	grpc.ServerStream
}

func (x *agentSendStreamServer) SendAndClose(m *SendStreamResp) error {
	return x.ServerStream.SendMsg(m)
}

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

func _Agent_GetStream_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(GetStreamReq)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(AgentServer).GetStream(m, &agentGetStreamServer{stream})
}

type Agent_GetStreamServer interface {
	Send(*StreamDataPacket) error
	grpc.ServerStream
}

type agentGetStreamServer struct {
	grpc.ServerStream
}

func (x *agentGetStreamServer) Send(m *StreamDataPacket) error {
	return x.ServerStream.SendMsg(m)
}

func _Agent_SendVar_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SendVarReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).SendVar(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_SendVar_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).SendVar(ctx, req.(*SendVarReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Agent_GetVar_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetVarReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).GetVar(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_GetVar_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).GetVar(ctx, req.(*GetVarReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Agent_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PingReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).Ping(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_Ping_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).Ping(ctx, req.(*PingReq))
	}
	return interceptor(ctx, in, info, handler)
}

// Agent_ServiceDesc is the grpc.ServiceDesc for Agent service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Agent_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Agent",
	HandlerType: (*AgentServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ExecuteIOPlan",
			Handler:    _Agent_ExecuteIOPlan_Handler,
		},
		{
			MethodName: "SendVar",
			Handler:    _Agent_SendVar_Handler,
		},
		{
			MethodName: "GetVar",
			Handler:    _Agent_GetVar_Handler,
		},
		{
			MethodName: "Ping",
			Handler:    _Agent_Ping_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "SendStream",
			Handler:       _Agent_SendStream_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "GetStream",
			Handler:       _Agent_GetStream_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "pkgs/grpc/agent/agent.proto",
}
