// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             v5.26.1
// source: grpc/flow_handler.proto

package grpc

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 (
	FlowHandler_Submit_FullMethodName = "/grpc.FlowHandler/Submit"
)

// FlowHandlerClient is the client API for FlowHandler 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 FlowHandlerClient interface {
	// Submit is a streaming RPC that accepts a stream of Observations from
	// conntrack and returns a summary with the number of processed
	// observations.
	Submit(ctx context.Context, opts ...grpc.CallOption) (FlowHandler_SubmitClient, error)
}

type flowHandlerClient struct {
	cc grpc.ClientConnInterface
}

func NewFlowHandlerClient(cc grpc.ClientConnInterface) FlowHandlerClient {
	return &flowHandlerClient{cc}
}

func (c *flowHandlerClient) Submit(ctx context.Context, opts ...grpc.CallOption) (FlowHandler_SubmitClient, error) {
	stream, err := c.cc.NewStream(ctx, &FlowHandler_ServiceDesc.Streams[0], FlowHandler_Submit_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &flowHandlerSubmitClient{stream}
	return x, nil
}

type FlowHandler_SubmitClient interface {
	Send(*Observation) error
	CloseAndRecv() (*ObservationSummary, error)
	grpc.ClientStream
}

type flowHandlerSubmitClient struct {
	grpc.ClientStream
}

func (x *flowHandlerSubmitClient) Send(m *Observation) error {
	return x.ClientStream.SendMsg(m)
}

func (x *flowHandlerSubmitClient) CloseAndRecv() (*ObservationSummary, error) {
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	m := new(ObservationSummary)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// FlowHandlerServer is the server API for FlowHandler service.
// All implementations must embed UnimplementedFlowHandlerServer
// for forward compatibility
type FlowHandlerServer interface {
	// Submit is a streaming RPC that accepts a stream of Observations from
	// conntrack and returns a summary with the number of processed
	// observations.
	Submit(FlowHandler_SubmitServer) error
	mustEmbedUnimplementedFlowHandlerServer()
}

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

func (UnimplementedFlowHandlerServer) Submit(FlowHandler_SubmitServer) error {
	return status.Errorf(codes.Unimplemented, "method Submit not implemented")
}
func (UnimplementedFlowHandlerServer) mustEmbedUnimplementedFlowHandlerServer() {}

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

func RegisterFlowHandlerServer(s grpc.ServiceRegistrar, srv FlowHandlerServer) {
	s.RegisterService(&FlowHandler_ServiceDesc, srv)
}

func _FlowHandler_Submit_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(FlowHandlerServer).Submit(&flowHandlerSubmitServer{stream})
}

type FlowHandler_SubmitServer interface {
	SendAndClose(*ObservationSummary) error
	Recv() (*Observation, error)
	grpc.ServerStream
}

type flowHandlerSubmitServer struct {
	grpc.ServerStream
}

func (x *flowHandlerSubmitServer) SendAndClose(m *ObservationSummary) error {
	return x.ServerStream.SendMsg(m)
}

func (x *flowHandlerSubmitServer) Recv() (*Observation, error) {
	m := new(Observation)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// FlowHandler_ServiceDesc is the grpc.ServiceDesc for FlowHandler service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var FlowHandler_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc.FlowHandler",
	HandlerType: (*FlowHandlerServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Submit",
			Handler:       _FlowHandler_Submit_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "grpc/flow_handler.proto",
}
