// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             v4.24.2
// source: loggregator-api/v2/egress.proto

package loggregator_v2

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

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

const (
	Egress_Receiver_FullMethodName        = "/loggregator.v2.Egress/Receiver"
	Egress_BatchedReceiver_FullMethodName = "/loggregator.v2.Egress/BatchedReceiver"
)

// EgressClient is the client API for Egress 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 EgressClient interface {
	Receiver(ctx context.Context, in *EgressRequest, opts ...grpc.CallOption) (Egress_ReceiverClient, error)
	BatchedReceiver(ctx context.Context, in *EgressBatchRequest, opts ...grpc.CallOption) (Egress_BatchedReceiverClient, error)
}

type egressClient struct {
	cc grpc.ClientConnInterface
}

func NewEgressClient(cc grpc.ClientConnInterface) EgressClient {
	return &egressClient{cc}
}

func (c *egressClient) Receiver(ctx context.Context, in *EgressRequest, opts ...grpc.CallOption) (Egress_ReceiverClient, error) {
	stream, err := c.cc.NewStream(ctx, &Egress_ServiceDesc.Streams[0], Egress_Receiver_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &egressReceiverClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type Egress_ReceiverClient interface {
	Recv() (*Envelope, error)
	grpc.ClientStream
}

type egressReceiverClient struct {
	grpc.ClientStream
}

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

func (c *egressClient) BatchedReceiver(ctx context.Context, in *EgressBatchRequest, opts ...grpc.CallOption) (Egress_BatchedReceiverClient, error) {
	stream, err := c.cc.NewStream(ctx, &Egress_ServiceDesc.Streams[1], Egress_BatchedReceiver_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &egressBatchedReceiverClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type Egress_BatchedReceiverClient interface {
	Recv() (*EnvelopeBatch, error)
	grpc.ClientStream
}

type egressBatchedReceiverClient struct {
	grpc.ClientStream
}

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

// EgressServer is the server API for Egress service.
// All implementations must embed UnimplementedEgressServer
// for forward compatibility
type EgressServer interface {
	Receiver(*EgressRequest, Egress_ReceiverServer) error
	BatchedReceiver(*EgressBatchRequest, Egress_BatchedReceiverServer) error
	mustEmbedUnimplementedEgressServer()
}

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

func (UnimplementedEgressServer) Receiver(*EgressRequest, Egress_ReceiverServer) error {
	return status.Errorf(codes.Unimplemented, "method Receiver not implemented")
}
func (UnimplementedEgressServer) BatchedReceiver(*EgressBatchRequest, Egress_BatchedReceiverServer) error {
	return status.Errorf(codes.Unimplemented, "method BatchedReceiver not implemented")
}
func (UnimplementedEgressServer) mustEmbedUnimplementedEgressServer() {}

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

func RegisterEgressServer(s grpc.ServiceRegistrar, srv EgressServer) {
	s.RegisterService(&Egress_ServiceDesc, srv)
}

func _Egress_Receiver_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(EgressRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(EgressServer).Receiver(m, &egressReceiverServer{stream})
}

type Egress_ReceiverServer interface {
	Send(*Envelope) error
	grpc.ServerStream
}

type egressReceiverServer struct {
	grpc.ServerStream
}

func (x *egressReceiverServer) Send(m *Envelope) error {
	return x.ServerStream.SendMsg(m)
}

func _Egress_BatchedReceiver_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(EgressBatchRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(EgressServer).BatchedReceiver(m, &egressBatchedReceiverServer{stream})
}

type Egress_BatchedReceiverServer interface {
	Send(*EnvelopeBatch) error
	grpc.ServerStream
}

type egressBatchedReceiverServer struct {
	grpc.ServerStream
}

func (x *egressBatchedReceiverServer) Send(m *EnvelopeBatch) error {
	return x.ServerStream.SendMsg(m)
}

// Egress_ServiceDesc is the grpc.ServiceDesc for Egress service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Egress_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "loggregator.v2.Egress",
	HandlerType: (*EgressServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Receiver",
			Handler:       _Egress_Receiver_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "BatchedReceiver",
			Handler:       _Egress_BatchedReceiver_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "loggregator-api/v2/egress.proto",
}
