// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v3.11.4
// source: github.com/moby/buildkit/api/services/control/control.proto

package moby_buildkit_v1

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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	Control_DiskUsage_FullMethodName          = "/moby.buildkit.v1.Control/DiskUsage"
	Control_Prune_FullMethodName              = "/moby.buildkit.v1.Control/Prune"
	Control_Solve_FullMethodName              = "/moby.buildkit.v1.Control/Solve"
	Control_Status_FullMethodName             = "/moby.buildkit.v1.Control/Status"
	Control_Session_FullMethodName            = "/moby.buildkit.v1.Control/Session"
	Control_ListWorkers_FullMethodName        = "/moby.buildkit.v1.Control/ListWorkers"
	Control_Info_FullMethodName               = "/moby.buildkit.v1.Control/Info"
	Control_ListenBuildHistory_FullMethodName = "/moby.buildkit.v1.Control/ListenBuildHistory"
	Control_UpdateBuildHistory_FullMethodName = "/moby.buildkit.v1.Control/UpdateBuildHistory"
)

// ControlClient is the client API for Control 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 ControlClient interface {
	DiskUsage(ctx context.Context, in *DiskUsageRequest, opts ...grpc.CallOption) (*DiskUsageResponse, error)
	Prune(ctx context.Context, in *PruneRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[UsageRecord], error)
	Solve(ctx context.Context, in *SolveRequest, opts ...grpc.CallOption) (*SolveResponse, error)
	Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StatusResponse], error)
	Session(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytesMessage, BytesMessage], error)
	ListWorkers(ctx context.Context, in *ListWorkersRequest, opts ...grpc.CallOption) (*ListWorkersResponse, error)
	Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error)
	ListenBuildHistory(ctx context.Context, in *BuildHistoryRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[BuildHistoryEvent], error)
	UpdateBuildHistory(ctx context.Context, in *UpdateBuildHistoryRequest, opts ...grpc.CallOption) (*UpdateBuildHistoryResponse, error)
}

type controlClient struct {
	cc grpc.ClientConnInterface
}

func NewControlClient(cc grpc.ClientConnInterface) ControlClient {
	return &controlClient{cc}
}

func (c *controlClient) DiskUsage(ctx context.Context, in *DiskUsageRequest, opts ...grpc.CallOption) (*DiskUsageResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(DiskUsageResponse)
	err := c.cc.Invoke(ctx, Control_DiskUsage_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *controlClient) Prune(ctx context.Context, in *PruneRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[UsageRecord], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Control_ServiceDesc.Streams[0], Control_Prune_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[PruneRequest, UsageRecord]{ClientStream: 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
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_PruneClient = grpc.ServerStreamingClient[UsageRecord]

func (c *controlClient) Solve(ctx context.Context, in *SolveRequest, opts ...grpc.CallOption) (*SolveResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(SolveResponse)
	err := c.cc.Invoke(ctx, Control_Solve_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *controlClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[StatusResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Control_ServiceDesc.Streams[1], Control_Status_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[StatusRequest, StatusResponse]{ClientStream: 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
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_StatusClient = grpc.ServerStreamingClient[StatusResponse]

func (c *controlClient) Session(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BytesMessage, BytesMessage], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Control_ServiceDesc.Streams[2], Control_Session_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[BytesMessage, BytesMessage]{ClientStream: stream}
	return x, nil
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_SessionClient = grpc.BidiStreamingClient[BytesMessage, BytesMessage]

func (c *controlClient) ListWorkers(ctx context.Context, in *ListWorkersRequest, opts ...grpc.CallOption) (*ListWorkersResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ListWorkersResponse)
	err := c.cc.Invoke(ctx, Control_ListWorkers_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *controlClient) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*InfoResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(InfoResponse)
	err := c.cc.Invoke(ctx, Control_Info_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *controlClient) ListenBuildHistory(ctx context.Context, in *BuildHistoryRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[BuildHistoryEvent], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Control_ServiceDesc.Streams[3], Control_ListenBuildHistory_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[BuildHistoryRequest, BuildHistoryEvent]{ClientStream: 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
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_ListenBuildHistoryClient = grpc.ServerStreamingClient[BuildHistoryEvent]

func (c *controlClient) UpdateBuildHistory(ctx context.Context, in *UpdateBuildHistoryRequest, opts ...grpc.CallOption) (*UpdateBuildHistoryResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(UpdateBuildHistoryResponse)
	err := c.cc.Invoke(ctx, Control_UpdateBuildHistory_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// ControlServer is the server API for Control service.
// All implementations should embed UnimplementedControlServer
// for forward compatibility.
type ControlServer interface {
	DiskUsage(context.Context, *DiskUsageRequest) (*DiskUsageResponse, error)
	Prune(*PruneRequest, grpc.ServerStreamingServer[UsageRecord]) error
	Solve(context.Context, *SolveRequest) (*SolveResponse, error)
	Status(*StatusRequest, grpc.ServerStreamingServer[StatusResponse]) error
	Session(grpc.BidiStreamingServer[BytesMessage, BytesMessage]) error
	ListWorkers(context.Context, *ListWorkersRequest) (*ListWorkersResponse, error)
	Info(context.Context, *InfoRequest) (*InfoResponse, error)
	ListenBuildHistory(*BuildHistoryRequest, grpc.ServerStreamingServer[BuildHistoryEvent]) error
	UpdateBuildHistory(context.Context, *UpdateBuildHistoryRequest) (*UpdateBuildHistoryResponse, error)
}

// UnimplementedControlServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedControlServer struct{}

func (UnimplementedControlServer) DiskUsage(context.Context, *DiskUsageRequest) (*DiskUsageResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method DiskUsage not implemented")
}
func (UnimplementedControlServer) Prune(*PruneRequest, grpc.ServerStreamingServer[UsageRecord]) error {
	return status.Errorf(codes.Unimplemented, "method Prune not implemented")
}
func (UnimplementedControlServer) Solve(context.Context, *SolveRequest) (*SolveResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Solve not implemented")
}
func (UnimplementedControlServer) Status(*StatusRequest, grpc.ServerStreamingServer[StatusResponse]) error {
	return status.Errorf(codes.Unimplemented, "method Status not implemented")
}
func (UnimplementedControlServer) Session(grpc.BidiStreamingServer[BytesMessage, BytesMessage]) error {
	return status.Errorf(codes.Unimplemented, "method Session not implemented")
}
func (UnimplementedControlServer) ListWorkers(context.Context, *ListWorkersRequest) (*ListWorkersResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListWorkers not implemented")
}
func (UnimplementedControlServer) Info(context.Context, *InfoRequest) (*InfoResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Info not implemented")
}
func (UnimplementedControlServer) ListenBuildHistory(*BuildHistoryRequest, grpc.ServerStreamingServer[BuildHistoryEvent]) error {
	return status.Errorf(codes.Unimplemented, "method ListenBuildHistory not implemented")
}
func (UnimplementedControlServer) UpdateBuildHistory(context.Context, *UpdateBuildHistoryRequest) (*UpdateBuildHistoryResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method UpdateBuildHistory not implemented")
}
func (UnimplementedControlServer) testEmbeddedByValue() {}

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

func RegisterControlServer(s grpc.ServiceRegistrar, srv ControlServer) {
	// If the following call pancis, it indicates UnimplementedControlServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&Control_ServiceDesc, srv)
}

func _Control_DiskUsage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(DiskUsageRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ControlServer).DiskUsage(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Control_DiskUsage_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ControlServer).DiskUsage(ctx, req.(*DiskUsageRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Control_Prune_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(PruneRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ControlServer).Prune(m, &grpc.GenericServerStream[PruneRequest, UsageRecord]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_PruneServer = grpc.ServerStreamingServer[UsageRecord]

func _Control_Solve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SolveRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ControlServer).Solve(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Control_Solve_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ControlServer).Solve(ctx, req.(*SolveRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Control_Status_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(StatusRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ControlServer).Status(m, &grpc.GenericServerStream[StatusRequest, StatusResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_StatusServer = grpc.ServerStreamingServer[StatusResponse]

func _Control_Session_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(ControlServer).Session(&grpc.GenericServerStream[BytesMessage, BytesMessage]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_SessionServer = grpc.BidiStreamingServer[BytesMessage, BytesMessage]

func _Control_ListWorkers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListWorkersRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ControlServer).ListWorkers(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Control_ListWorkers_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ControlServer).ListWorkers(ctx, req.(*ListWorkersRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Control_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(InfoRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ControlServer).Info(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Control_Info_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ControlServer).Info(ctx, req.(*InfoRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Control_ListenBuildHistory_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(BuildHistoryRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ControlServer).ListenBuildHistory(m, &grpc.GenericServerStream[BuildHistoryRequest, BuildHistoryEvent]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Control_ListenBuildHistoryServer = grpc.ServerStreamingServer[BuildHistoryEvent]

func _Control_UpdateBuildHistory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(UpdateBuildHistoryRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ControlServer).UpdateBuildHistory(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Control_UpdateBuildHistory_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ControlServer).UpdateBuildHistory(ctx, req.(*UpdateBuildHistoryRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Control_ServiceDesc is the grpc.ServiceDesc for Control service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Control_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "moby.buildkit.v1.Control",
	HandlerType: (*ControlServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "DiskUsage",
			Handler:    _Control_DiskUsage_Handler,
		},
		{
			MethodName: "Solve",
			Handler:    _Control_Solve_Handler,
		},
		{
			MethodName: "ListWorkers",
			Handler:    _Control_ListWorkers_Handler,
		},
		{
			MethodName: "Info",
			Handler:    _Control_Info_Handler,
		},
		{
			MethodName: "UpdateBuildHistory",
			Handler:    _Control_UpdateBuildHistory_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Prune",
			Handler:       _Control_Prune_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Status",
			Handler:       _Control_Status_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Session",
			Handler:       _Control_Session_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "ListenBuildHistory",
			Handler:       _Control_ListenBuildHistory_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "github.com/moby/buildkit/api/services/control/control.proto",
}
