// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: (devel)
// source: remote.proto

package remote

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

type drpcEncoding_File_remote_proto struct{}

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

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

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

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

type DRPCRemoteClient interface {
	DRPCConn() drpc.Conn

	Receive(ctx context.Context) (DRPCRemote_ReceiveClient, error)
}

type drpcRemoteClient struct {
	cc drpc.Conn
}

func NewDRPCRemoteClient(cc drpc.Conn) DRPCRemoteClient {
	return &drpcRemoteClient{cc}
}

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

func (c *drpcRemoteClient) Receive(ctx context.Context) (DRPCRemote_ReceiveClient, error) {
	stream, err := c.cc.NewStream(ctx, "/remote.Remote/Receive", drpcEncoding_File_remote_proto{})
	if err != nil {
		return nil, err
	}
	x := &drpcRemote_ReceiveClient{stream}
	return x, nil
}

type DRPCRemote_ReceiveClient interface {
	drpc.Stream
	Send(*Envelope) error
	Recv() (*Envelope, error)
}

type drpcRemote_ReceiveClient struct {
	drpc.Stream
}

func (x *drpcRemote_ReceiveClient) Send(m *Envelope) error {
	return x.MsgSend(m, drpcEncoding_File_remote_proto{})
}

func (x *drpcRemote_ReceiveClient) Recv() (*Envelope, error) {
	m := new(Envelope)
	if err := x.MsgRecv(m, drpcEncoding_File_remote_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcRemote_ReceiveClient) RecvMsg(m *Envelope) error {
	return x.MsgRecv(m, drpcEncoding_File_remote_proto{})
}

type DRPCRemoteServer interface {
	Receive(DRPCRemote_ReceiveStream) error
}

type DRPCRemoteUnimplementedServer struct{}

func (s *DRPCRemoteUnimplementedServer) Receive(DRPCRemote_ReceiveStream) error {
	return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}

type DRPCRemoteDescription struct{}

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

func (DRPCRemoteDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
	switch n {
	case 0:
		return "/remote.Remote/Receive", drpcEncoding_File_remote_proto{},
			func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
				return nil, srv.(DRPCRemoteServer).
					Receive(
						&drpcRemote_ReceiveStream{in1.(drpc.Stream)},
					)
			}, DRPCRemoteServer.Receive, true
	default:
		return "", nil, nil, nil, false
	}
}

func DRPCRegisterRemote(mux drpc.Mux, impl DRPCRemoteServer) error {
	return mux.Register(impl, DRPCRemoteDescription{})
}

type DRPCRemote_ReceiveStream interface {
	drpc.Stream
	Send(*Envelope) error
	Recv() (*Envelope, error)
}

type drpcRemote_ReceiveStream struct {
	drpc.Stream
}

func (x *drpcRemote_ReceiveStream) Send(m *Envelope) error {
	return x.MsgSend(m, drpcEncoding_File_remote_proto{})
}

func (x *drpcRemote_ReceiveStream) Recv() (*Envelope, error) {
	m := new(Envelope)
	if err := x.MsgRecv(m, drpcEncoding_File_remote_proto{}); err != nil {
		return nil, err
	}
	return m, nil
}

func (x *drpcRemote_ReceiveStream) RecvMsg(m *Envelope) error {
	return x.MsgRecv(m, drpcEncoding_File_remote_proto{})
}
