// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: v0.0.34
// source: net/streampool/testservice/protos/testservice.proto

package testservice

import (
	context "context"
	errors "errors"
	drpc1 "github.com/planetscale/vtprotobuf/codec/drpc"
	drpc "storj.io/drpc"
	drpcerr "storj.io/drpc/drpcerr"
)

type drpcEncoding_File_net_streampool_testservice_protos_testservice_proto struct{}

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

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

func (drpcEncoding_File_net_streampool_testservice_protos_testservice_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
	return drpc1.JSONMarshal(msg)
}

func (drpcEncoding_File_net_streampool_testservice_protos_testservice_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
	return drpc1.JSONUnmarshal(buf, msg)
}

type DRPCTestClient interface {
	DRPCConn() drpc.Conn

	TestStream(ctx context.Context) (DRPCTest_TestStreamClient, error)
	TestStream2(ctx context.Context, in *StreamMessage) (DRPCTest_TestStream2Client, error)
}

type drpcTestClient struct {
	cc drpc.Conn
}

func NewDRPCTestClient(cc drpc.Conn) DRPCTestClient {
	return &drpcTestClient{cc}
}

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

func (c *drpcTestClient) TestStream(ctx context.Context) (DRPCTest_TestStreamClient, error) {
	stream, err := c.cc.NewStream(ctx, "/testService.Test/TestStream", drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{})
	if err != nil {
		return nil, err
	}
	x := &drpcTest_TestStreamClient{stream}
	return x, nil
}

type DRPCTest_TestStreamClient interface {
	drpc.Stream
	Send(*StreamMessage) error
	Recv() (*StreamMessage, error)
}

type drpcTest_TestStreamClient struct {
	drpc.Stream
}

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

func (x *drpcTest_TestStreamClient) Send(m *StreamMessage) error {
	return x.MsgSend(m, drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{})
}

func (x *drpcTest_TestStreamClient) Recv() (*StreamMessage, error) {
	m := new(StreamMessage)
	if err := x.MsgRecv(m, drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcTest_TestStreamClient) RecvMsg(m *StreamMessage) error {
	return x.MsgRecv(m, drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{})
}

func (c *drpcTestClient) TestStream2(ctx context.Context, in *StreamMessage) (DRPCTest_TestStream2Client, error) {
	stream, err := c.cc.NewStream(ctx, "/testService.Test/TestStream2", drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{})
	if err != nil {
		return nil, err
	}
	x := &drpcTest_TestStream2Client{stream}
	if err := x.MsgSend(in, drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{}); err != nil {
		return nil, err
	}
	if err := x.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type DRPCTest_TestStream2Client interface {
	drpc.Stream
	Recv() (*StreamMessage, error)
}

type drpcTest_TestStream2Client struct {
	drpc.Stream
}

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

func (x *drpcTest_TestStream2Client) Recv() (*StreamMessage, error) {
	m := new(StreamMessage)
	if err := x.MsgRecv(m, drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcTest_TestStream2Client) RecvMsg(m *StreamMessage) error {
	return x.MsgRecv(m, drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{})
}

type DRPCTestServer interface {
	TestStream(DRPCTest_TestStreamStream) error
	TestStream2(*StreamMessage, DRPCTest_TestStream2Stream) error
}

type DRPCTestUnimplementedServer struct{}

func (s *DRPCTestUnimplementedServer) TestStream(DRPCTest_TestStreamStream) error {
	return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

func (s *DRPCTestUnimplementedServer) TestStream2(*StreamMessage, DRPCTest_TestStream2Stream) error {
	return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

type DRPCTestDescription struct{}

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

func (DRPCTestDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
	switch n {
	case 0:
		return "/testService.Test/TestStream", drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return nil, srv.(DRPCTestServer).
					TestStream(
						&drpcTest_TestStreamStream{in1.(drpc.Stream)},
					)
			}, DRPCTestServer.TestStream, true
	case 1:
		return "/testService.Test/TestStream2", drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return nil, srv.(DRPCTestServer).
					TestStream2(
						in1.(*StreamMessage),
						&drpcTest_TestStream2Stream{in2.(drpc.Stream)},
					)
			}, DRPCTestServer.TestStream2, true
	default:
		return "", nil, nil, nil, false
	}
}

func DRPCRegisterTest(mux drpc.Mux, impl DRPCTestServer) error {
	return mux.Register(impl, DRPCTestDescription{})
}

type DRPCTest_TestStreamStream interface {
	drpc.Stream
	Send(*StreamMessage) error
	Recv() (*StreamMessage, error)
}

type drpcTest_TestStreamStream struct {
	drpc.Stream
}

func (x *drpcTest_TestStreamStream) Send(m *StreamMessage) error {
	return x.MsgSend(m, drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{})
}

func (x *drpcTest_TestStreamStream) Recv() (*StreamMessage, error) {
	m := new(StreamMessage)
	if err := x.MsgRecv(m, drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcTest_TestStreamStream) RecvMsg(m *StreamMessage) error {
	return x.MsgRecv(m, drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{})
}

type DRPCTest_TestStream2Stream interface {
	drpc.Stream
	Send(*StreamMessage) error
}

type drpcTest_TestStream2Stream struct {
	drpc.Stream
}

func (x *drpcTest_TestStream2Stream) Send(m *StreamMessage) error {
	return x.MsgSend(m, drpcEncoding_File_net_streampool_testservice_protos_testservice_proto{})
}
