// Code generated by protoc-gen-go-grpc. DO NOT EDIT.

package v10

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	v3 "github.com/apache/skywalking-go/protocols/collect/common/v3"
)

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

// PprofTaskClient is the client API for PprofTask 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 PprofTaskClient interface {
	// collect pprof data to the OAP server.
	Collect(ctx context.Context, opts ...grpc.CallOption) (PprofTask_CollectClient, error)
	// getPprofTaskCommands sends query to the OAP server for all pprof tasks to be executed for the given Go Agent instance
	GetPprofTaskCommands(ctx context.Context, in *PprofTaskCommandQuery, opts ...grpc.CallOption) (*v3.Commands, error)
}

type pprofTaskClient struct {
	cc grpc.ClientConnInterface
}

func NewPprofTaskClient(cc grpc.ClientConnInterface) PprofTaskClient {
	return &pprofTaskClient{cc}
}

func (c *pprofTaskClient) Collect(ctx context.Context, opts ...grpc.CallOption) (PprofTask_CollectClient, error) {
	stream, err := c.cc.NewStream(ctx, &PprofTask_ServiceDesc.Streams[0], "/skywalking.v10.PprofTask/collect", opts...)
	if err != nil {
		return nil, err
	}
	x := &pprofTaskCollectClient{stream}
	return x, nil
}

type PprofTask_CollectClient interface {
	Send(*PprofData) error
	Recv() (*PprofCollectionResponse, error)
	grpc.ClientStream
}

type pprofTaskCollectClient struct {
	grpc.ClientStream
}

func (x *pprofTaskCollectClient) Send(m *PprofData) error {
	return x.ClientStream.SendMsg(m)
}

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

func (c *pprofTaskClient) GetPprofTaskCommands(ctx context.Context, in *PprofTaskCommandQuery, opts ...grpc.CallOption) (*v3.Commands, error) {
	out := new(v3.Commands)
	err := c.cc.Invoke(ctx, "/skywalking.v10.PprofTask/getPprofTaskCommands", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// PprofTaskServer is the server API for PprofTask service.
// All implementations must embed UnimplementedPprofTaskServer
// for forward compatibility
type PprofTaskServer interface {
	// collect pprof data to the OAP server.
	Collect(PprofTask_CollectServer) error
	// getPprofTaskCommands sends query to the OAP server for all pprof tasks to be executed for the given Go Agent instance
	GetPprofTaskCommands(context.Context, *PprofTaskCommandQuery) (*v3.Commands, error)
	mustEmbedUnimplementedPprofTaskServer()
}

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

func (UnimplementedPprofTaskServer) Collect(PprofTask_CollectServer) error {
	return status.Errorf(codes.Unimplemented, "method Collect not implemented")
}
func (UnimplementedPprofTaskServer) GetPprofTaskCommands(context.Context, *PprofTaskCommandQuery) (*v3.Commands, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetPprofTaskCommands not implemented")
}
func (UnimplementedPprofTaskServer) mustEmbedUnimplementedPprofTaskServer() {}

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

func RegisterPprofTaskServer(s grpc.ServiceRegistrar, srv PprofTaskServer) {
	s.RegisterService(&PprofTask_ServiceDesc, srv)
}

func _PprofTask_Collect_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(PprofTaskServer).Collect(&pprofTaskCollectServer{stream})
}

type PprofTask_CollectServer interface {
	Send(*PprofCollectionResponse) error
	Recv() (*PprofData, error)
	grpc.ServerStream
}

type pprofTaskCollectServer struct {
	grpc.ServerStream
}

func (x *pprofTaskCollectServer) Send(m *PprofCollectionResponse) error {
	return x.ServerStream.SendMsg(m)
}

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

func _PprofTask_GetPprofTaskCommands_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PprofTaskCommandQuery)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PprofTaskServer).GetPprofTaskCommands(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/skywalking.v10.PprofTask/getPprofTaskCommands",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PprofTaskServer).GetPprofTaskCommands(ctx, req.(*PprofTaskCommandQuery))
	}
	return interceptor(ctx, in, info, handler)
}

// PprofTask_ServiceDesc is the grpc.ServiceDesc for PprofTask service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PprofTask_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "skywalking.v10.PprofTask",
	HandlerType: (*PprofTaskServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "getPprofTaskCommands",
			Handler:    _PprofTask_GetPprofTaskCommands_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "collect",
			Handler:       _PprofTask_Collect_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "pprof/Pprof.proto",
}
