// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: v0.0.34
// 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)
}

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{})
}

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

type DRPCDebugUnimplementedServer struct{}

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

type DRPCDebugDescription struct{}

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

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
	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) Send(m *CollectRuntimeTracesResponse) error {
	return x.MsgSend(m, drpcEncoding_File_debug_proto{})
}
