// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v3.21.6
// source: greptime/v1/flow/server.proto

package flow

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

// FlowClient is the client API for Flow 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 FlowClient interface {
	// Handle the control plane request for creating or removing a flow.
	HandleCreateRemove(ctx context.Context, in *FlowRequest, opts ...grpc.CallOption) (*FlowResponse, error)
	// Handle the data plane request for inserting or deleting rows
	// only expect `RegionRequest` to be one of `InsertRequests` or
	// `DeleteRequests` other types of `RegionRequest` will be ignored
	HandleMirrorRequest(ctx context.Context, in *InsertRequests, opts ...grpc.CallOption) (*FlowResponse, error)
	HandleMarkDirtyTimeWindow(ctx context.Context, in *DirtyWindowRequests, opts ...grpc.CallOption) (*FlowResponse, error)
}

type flowClient struct {
	cc grpc.ClientConnInterface
}

func NewFlowClient(cc grpc.ClientConnInterface) FlowClient {
	return &flowClient{cc}
}

func (c *flowClient) HandleCreateRemove(ctx context.Context, in *FlowRequest, opts ...grpc.CallOption) (*FlowResponse, error) {
	out := new(FlowResponse)
	err := c.cc.Invoke(ctx, "/greptime.v1.flow.Flow/HandleCreateRemove", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *flowClient) HandleMirrorRequest(ctx context.Context, in *InsertRequests, opts ...grpc.CallOption) (*FlowResponse, error) {
	out := new(FlowResponse)
	err := c.cc.Invoke(ctx, "/greptime.v1.flow.Flow/HandleMirrorRequest", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *flowClient) HandleMarkDirtyTimeWindow(ctx context.Context, in *DirtyWindowRequests, opts ...grpc.CallOption) (*FlowResponse, error) {
	out := new(FlowResponse)
	err := c.cc.Invoke(ctx, "/greptime.v1.flow.Flow/HandleMarkDirtyTimeWindow", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// FlowServer is the server API for Flow service.
// All implementations must embed UnimplementedFlowServer
// for forward compatibility
type FlowServer interface {
	// Handle the control plane request for creating or removing a flow.
	HandleCreateRemove(context.Context, *FlowRequest) (*FlowResponse, error)
	// Handle the data plane request for inserting or deleting rows
	// only expect `RegionRequest` to be one of `InsertRequests` or
	// `DeleteRequests` other types of `RegionRequest` will be ignored
	HandleMirrorRequest(context.Context, *InsertRequests) (*FlowResponse, error)
	HandleMarkDirtyTimeWindow(context.Context, *DirtyWindowRequests) (*FlowResponse, error)
	mustEmbedUnimplementedFlowServer()
}

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

func (UnimplementedFlowServer) HandleCreateRemove(context.Context, *FlowRequest) (*FlowResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method HandleCreateRemove not implemented")
}
func (UnimplementedFlowServer) HandleMirrorRequest(context.Context, *InsertRequests) (*FlowResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method HandleMirrorRequest not implemented")
}
func (UnimplementedFlowServer) HandleMarkDirtyTimeWindow(context.Context, *DirtyWindowRequests) (*FlowResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method HandleMarkDirtyTimeWindow not implemented")
}
func (UnimplementedFlowServer) mustEmbedUnimplementedFlowServer() {}

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

func RegisterFlowServer(s grpc.ServiceRegistrar, srv FlowServer) {
	s.RegisterService(&Flow_ServiceDesc, srv)
}

func _Flow_HandleCreateRemove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(FlowRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(FlowServer).HandleCreateRemove(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/greptime.v1.flow.Flow/HandleCreateRemove",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(FlowServer).HandleCreateRemove(ctx, req.(*FlowRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Flow_HandleMirrorRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(InsertRequests)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(FlowServer).HandleMirrorRequest(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/greptime.v1.flow.Flow/HandleMirrorRequest",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(FlowServer).HandleMirrorRequest(ctx, req.(*InsertRequests))
	}
	return interceptor(ctx, in, info, handler)
}

func _Flow_HandleMarkDirtyTimeWindow_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(DirtyWindowRequests)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(FlowServer).HandleMarkDirtyTimeWindow(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/greptime.v1.flow.Flow/HandleMarkDirtyTimeWindow",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(FlowServer).HandleMarkDirtyTimeWindow(ctx, req.(*DirtyWindowRequests))
	}
	return interceptor(ctx, in, info, handler)
}

// Flow_ServiceDesc is the grpc.ServiceDesc for Flow service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Flow_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "greptime.v1.flow.Flow",
	HandlerType: (*FlowServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "HandleCreateRemove",
			Handler:    _Flow_HandleCreateRemove_Handler,
		},
		{
			MethodName: "HandleMirrorRequest",
			Handler:    _Flow_HandleMirrorRequest_Handler,
		},
		{
			MethodName: "HandleMarkDirtyTimeWindow",
			Handler:    _Flow_HandleMarkDirtyTimeWindow_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "greptime/v1/flow/server.proto",
}
