// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: v0.0.35-0.20250513201419-f7819ea69b55
// source: debug.proto

package pb

import (
	bytes "bytes"
	context "context"
	errors "errors"

	jsonpb "github.com/gogo/protobuf/jsonpb"
	proto "github.com/gogo/protobuf/proto"

	drpc "storj.io/drpc"
	drpcerr "storj.io/drpc/drpcerr"
)

type drpcEncoding_File_debug_proto struct{}

func (drpcEncoding_File_debug_proto) Marshal(msg drpc.Message) ([]byte, error) {
	return proto.Marshal(msg.(proto.Message))
}

func (drpcEncoding_File_debug_proto) Unmarshal(buf []byte, msg drpc.Message) error {
	return proto.Unmarshal(buf, msg.(proto.Message))
}

func (drpcEncoding_File_debug_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
	var buf bytes.Buffer
	err := new(jsonpb.Marshaler).Marshal(&buf, msg.(proto.Message))
	if err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}

func (drpcEncoding_File_debug_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
	return jsonpb.Unmarshal(bytes.NewReader(buf), msg.(proto.Message))
}

type DRPCDebugClient interface {
	DRPCConn() drpc.Conn

	CollectRuntimeTraces(ctx context.Context, in *CollectRuntimeTracesRequest) (DRPCDebug_CollectRuntimeTracesClient, error)
	CollectRuntimeTraces2(ctx context.Context) (DRPCDebug_CollectRuntimeTraces2Client, error)
}

type drpcDebugClient struct {
	cc drpc.Conn
}

func NewDRPCDebugClient(cc drpc.Conn) DRPCDebugClient {
	return &drpcDebugClient{cc}
}

func (c *drpcDebugClient) DRPCConn() drpc.Conn { return c.cc }

func (c *drpcDebugClient) CollectRuntimeTraces(ctx context.Context, in *CollectRuntimeTracesRequest) (DRPCDebug_CollectRuntimeTracesClient, error) {
	stream, err := c.cc.NewStream(ctx, "/debug.Debug/CollectRuntimeTraces", drpcEncoding_File_debug_proto{})
	if err != nil {
		return nil, err
	}
	x := &drpcDebug_CollectRuntimeTracesClient{stream}
	if err := x.MsgSend(in, drpcEncoding_File_debug_proto{}); err != nil {
		return nil, err
	}
	if err := x.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type DRPCDebug_CollectRuntimeTracesClient interface {
	drpc.Stream
	Recv() (*CollectRuntimeTracesResponse, error)
}

type drpcDebug_CollectRuntimeTracesClient struct {
	drpc.Stream
}

func (x *drpcDebug_CollectRuntimeTracesClient) GetStream() drpc.Stream {
	return x.Stream
}

func (x *drpcDebug_CollectRuntimeTracesClient) Recv() (*CollectRuntimeTracesResponse, error) {
	m := new(CollectRuntimeTracesResponse)
	if err := x.MsgRecv(m, drpcEncoding_File_debug_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcDebug_CollectRuntimeTracesClient) RecvMsg(m *CollectRuntimeTracesResponse) error {
	return x.MsgRecv(m, drpcEncoding_File_debug_proto{})
}

func (c *drpcDebugClient) CollectRuntimeTraces2(ctx context.Context) (DRPCDebug_CollectRuntimeTraces2Client, error) {
	stream, err := c.cc.NewStream(ctx, "/debug.Debug/CollectRuntimeTraces2", drpcEncoding_File_debug_proto{})
	if err != nil {
		return nil, err
	}
	x := &drpcDebug_CollectRuntimeTraces2Client{stream}
	return x, nil
}

type DRPCDebug_CollectRuntimeTraces2Client interface {
	drpc.Stream
	Send(*CollectRuntimeTracesRequest) error
	Recv() (*CollectRuntimeTracesResponse, error)
}

type drpcDebug_CollectRuntimeTraces2Client struct {
	drpc.Stream
}

func (x *drpcDebug_CollectRuntimeTraces2Client) GetStream() drpc.Stream {
	return x.Stream
}

func (x *drpcDebug_CollectRuntimeTraces2Client) Send(m *CollectRuntimeTracesRequest) error {
	return x.MsgSend(m, drpcEncoding_File_debug_proto{})
}

func (x *drpcDebug_CollectRuntimeTraces2Client) Recv() (*CollectRuntimeTracesResponse, error) {
	m := new(CollectRuntimeTracesResponse)
	if err := x.MsgRecv(m, drpcEncoding_File_debug_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcDebug_CollectRuntimeTraces2Client) RecvMsg(m *CollectRuntimeTracesResponse) error {
	return x.MsgRecv(m, drpcEncoding_File_debug_proto{})
}

type DRPCDebugServer interface {
	CollectRuntimeTraces(*CollectRuntimeTracesRequest, DRPCDebug_CollectRuntimeTracesStream) error
	CollectRuntimeTraces2(DRPCDebug_CollectRuntimeTraces2Stream) error
}

type DRPCDebugUnimplementedServer struct{}

func (s *DRPCDebugUnimplementedServer) CollectRuntimeTraces(*CollectRuntimeTracesRequest, DRPCDebug_CollectRuntimeTracesStream) error {
	return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

func (s *DRPCDebugUnimplementedServer) CollectRuntimeTraces2(DRPCDebug_CollectRuntimeTraces2Stream) error {
	return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

type DRPCDebugDescription struct{}

func (DRPCDebugDescription) NumMethods() int { return 2 }

func (DRPCDebugDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
	switch n {
	case 0:
		return "/debug.Debug/CollectRuntimeTraces", drpcEncoding_File_debug_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return nil, srv.(DRPCDebugServer).
					CollectRuntimeTraces(
						in1.(*CollectRuntimeTracesRequest),
						&drpcDebug_CollectRuntimeTracesStream{in2.(drpc.Stream)},
					)
			}, DRPCDebugServer.CollectRuntimeTraces, true
	case 1:
		return "/debug.Debug/CollectRuntimeTraces2", drpcEncoding_File_debug_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return nil, srv.(DRPCDebugServer).
					CollectRuntimeTraces2(
						&drpcDebug_CollectRuntimeTraces2Stream{in1.(drpc.Stream)},
					)
			}, DRPCDebugServer.CollectRuntimeTraces2, true
	default:
		return "", nil, nil, nil, false
	}
}

func DRPCRegisterDebug(mux drpc.Mux, impl DRPCDebugServer) error {
	return mux.Register(impl, DRPCDebugDescription{})
}

type DRPCDebug_CollectRuntimeTracesStream interface {
	drpc.Stream
	Send(*CollectRuntimeTracesResponse) error
}

type drpcDebug_CollectRuntimeTracesStream struct {
	drpc.Stream
}

func (x *drpcDebug_CollectRuntimeTracesStream) GetStream() drpc.Stream {
	return x.Stream
}

func (x *drpcDebug_CollectRuntimeTracesStream) Send(m *CollectRuntimeTracesResponse) error {
	return x.MsgSend(m, drpcEncoding_File_debug_proto{})
}

type DRPCDebug_CollectRuntimeTraces2Stream interface {
	drpc.Stream
	Send(*CollectRuntimeTracesResponse) error
	Recv() (*CollectRuntimeTracesRequest, error)
}

type drpcDebug_CollectRuntimeTraces2Stream struct {
	drpc.Stream
}

func (x *drpcDebug_CollectRuntimeTraces2Stream) GetStream() drpc.Stream {
	return x.Stream
}

func (x *drpcDebug_CollectRuntimeTraces2Stream) Send(m *CollectRuntimeTracesResponse) error {
	return x.MsgSend(m, drpcEncoding_File_debug_proto{})
}

func (x *drpcDebug_CollectRuntimeTraces2Stream) Recv() (*CollectRuntimeTracesRequest, error) {
	m := new(CollectRuntimeTracesRequest)
	if err := x.MsgRecv(m, drpcEncoding_File_debug_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcDebug_CollectRuntimeTraces2Stream) RecvMsg(m *CollectRuntimeTracesRequest) error {
	return x.MsgRecv(m, drpcEncoding_File_debug_proto{})
}
