queues

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobQueueWorkerService_AcceptJobs_FullMethodName  = "/salad.grpc.saladcloud_job_queue_worker.v1alpha.JobQueueWorkerService/AcceptJobs"
	JobQueueWorkerService_CompleteJob_FullMethodName = "/salad.grpc.saladcloud_job_queue_worker.v1alpha.JobQueueWorkerService/CompleteJob"
	JobQueueWorkerService_RejectJob_FullMethodName   = "/salad.grpc.saladcloud_job_queue_worker.v1alpha.JobQueueWorkerService/RejectJob"
)

Variables

View Source
var File_salad_grpc_saladcloud_job_queue_worker_v1alpha_service_v1alpha_proto protoreflect.FileDescriptor
View Source
var JobQueueWorkerService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "salad.grpc.saladcloud_job_queue_worker.v1alpha.JobQueueWorkerService",
	HandlerType: (*JobQueueWorkerServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CompleteJob",
			Handler:    _JobQueueWorkerService_CompleteJob_Handler,
		},
		{
			MethodName: "RejectJob",
			Handler:    _JobQueueWorkerService_RejectJob_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "AcceptJobs",
			Handler:       _JobQueueWorkerService_AcceptJobs_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "salad/grpc/saladcloud_job_queue_worker/v1alpha/service_v1alpha.proto",
}

JobQueueWorkerService_ServiceDesc is the grpc.ServiceDesc for JobQueueWorkerService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterJobQueueWorkerServiceServer

func RegisterJobQueueWorkerServiceServer(s grpc.ServiceRegistrar, srv JobQueueWorkerServiceServer)

Types

type AcceptJobsRequest

type AcceptJobsRequest struct {

	// The identifier of the currently running job. Optional. This should be
	// specified when the worker reconnects after a transient error and has not
	// yet completed or rejected the job.
	CurrentJobId string `protobuf:"bytes,1,opt,name=current_job_id,json=currentJobId,proto3" json:"current_job_id,omitempty"`
	// contains filtered or unexported fields
}

Represents a request to the `AcceptJobs` method.

func (*AcceptJobsRequest) Descriptor deprecated

func (*AcceptJobsRequest) Descriptor() ([]byte, []int)

Deprecated: Use AcceptJobsRequest.ProtoReflect.Descriptor instead.

func (*AcceptJobsRequest) GetCurrentJobId

func (x *AcceptJobsRequest) GetCurrentJobId() string

func (*AcceptJobsRequest) ProtoMessage

func (*AcceptJobsRequest) ProtoMessage()

func (*AcceptJobsRequest) ProtoReflect

func (x *AcceptJobsRequest) ProtoReflect() protoreflect.Message

func (*AcceptJobsRequest) Reset

func (x *AcceptJobsRequest) Reset()

func (*AcceptJobsRequest) String

func (x *AcceptJobsRequest) String() string

type AcceptJobsResponse

type AcceptJobsResponse struct {

	// The stream message.
	//
	// Types that are assignable to Message:
	//
	//	*AcceptJobsResponse_Heartbeat
	//	*AcceptJobsResponse_Job
	Message isAcceptJobsResponse_Message `protobuf_oneof:"message"`
	// contains filtered or unexported fields
}

Represents a response from the `AcceptJobs` method.

func (*AcceptJobsResponse) Descriptor deprecated

func (*AcceptJobsResponse) Descriptor() ([]byte, []int)

Deprecated: Use AcceptJobsResponse.ProtoReflect.Descriptor instead.

func (*AcceptJobsResponse) GetHeartbeat

func (x *AcceptJobsResponse) GetHeartbeat() *emptypb.Empty

func (*AcceptJobsResponse) GetJob

func (x *AcceptJobsResponse) GetJob() *Job

func (*AcceptJobsResponse) GetMessage

func (m *AcceptJobsResponse) GetMessage() isAcceptJobsResponse_Message

func (*AcceptJobsResponse) ProtoMessage

func (*AcceptJobsResponse) ProtoMessage()

func (*AcceptJobsResponse) ProtoReflect

func (x *AcceptJobsResponse) ProtoReflect() protoreflect.Message

func (*AcceptJobsResponse) Reset

func (x *AcceptJobsResponse) Reset()

func (*AcceptJobsResponse) String

func (x *AcceptJobsResponse) String() string

type AcceptJobsResponse_Heartbeat

type AcceptJobsResponse_Heartbeat struct {
	// An empty message used to health check the stream. The worker should
	// ignore this message.
	Heartbeat *emptypb.Empty `protobuf:"bytes,1,opt,name=heartbeat,proto3,oneof"`
}

type AcceptJobsResponse_Job

type AcceptJobsResponse_Job struct {
	// The next job to be executed. The worker must call either
	// `CompleteJob` or `RejectJob` with the result.
	Job *Job `protobuf:"bytes,2,opt,name=job,proto3,oneof"`
}

type CompleteJobRequest

type CompleteJobRequest struct {

	// The identifier of the job.
	JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// The HTTP response body.
	Output []byte `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"`
	// contains filtered or unexported fields
}

Represents a request to the `CompleteJob` method.

func (*CompleteJobRequest) Descriptor deprecated

func (*CompleteJobRequest) Descriptor() ([]byte, []int)

Deprecated: Use CompleteJobRequest.ProtoReflect.Descriptor instead.

func (*CompleteJobRequest) GetJobId

func (x *CompleteJobRequest) GetJobId() string

func (*CompleteJobRequest) GetOutput

func (x *CompleteJobRequest) GetOutput() []byte

func (*CompleteJobRequest) ProtoMessage

func (*CompleteJobRequest) ProtoMessage()

func (*CompleteJobRequest) ProtoReflect

func (x *CompleteJobRequest) ProtoReflect() protoreflect.Message

func (*CompleteJobRequest) Reset

func (x *CompleteJobRequest) Reset()

func (*CompleteJobRequest) String

func (x *CompleteJobRequest) String() string

type Job

type Job struct {

	// The identifier of the job.
	JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// The port number of the HTTP server.
	Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
	// The HTTP request path.
	Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"`
	// The HTTP request body.
	Input []byte `protobuf:"bytes,4,opt,name=input,proto3" json:"input,omitempty"`
	// contains filtered or unexported fields
}

Represents a job.

func (*Job) Descriptor deprecated

func (*Job) Descriptor() ([]byte, []int)

Deprecated: Use Job.ProtoReflect.Descriptor instead.

func (*Job) GetInput

func (x *Job) GetInput() []byte

func (*Job) GetJobId

func (x *Job) GetJobId() string

func (*Job) GetPath

func (x *Job) GetPath() string

func (*Job) GetPort

func (x *Job) GetPort() int32

func (*Job) ProtoMessage

func (*Job) ProtoMessage()

func (*Job) ProtoReflect

func (x *Job) ProtoReflect() protoreflect.Message

func (*Job) Reset

func (x *Job) Reset()

func (*Job) String

func (x *Job) String() string

type JobQueueWorkerServiceClient

type JobQueueWorkerServiceClient interface {
	// Starts a long-running stream to accept jobs. At any given time, the
	// worker should have at most one stream open. The worker will receive at
	// most one job at a time. The service will wait until the worker completes
	// or rejects the job, by calling `CompleteJob` or `RejectJob`, before
	// sending the next job. The worker is considered available to accept jobs
	// as long as the stream is open. This may return an error with a `NotFound`
	// status code if the currently running job no longer exists.
	AcceptJobs(ctx context.Context, in *AcceptJobsRequest, opts ...grpc.CallOption) (JobQueueWorkerService_AcceptJobsClient, error)
	// Completes a job.
	CompleteJob(ctx context.Context, in *CompleteJobRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Rejects a job.
	RejectJob(ctx context.Context, in *RejectJobRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

JobQueueWorkerServiceClient is the client API for JobQueueWorkerService 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 JobQueueWorkerServiceServer

type JobQueueWorkerServiceServer interface {
	// Starts a long-running stream to accept jobs. At any given time, the
	// worker should have at most one stream open. The worker will receive at
	// most one job at a time. The service will wait until the worker completes
	// or rejects the job, by calling `CompleteJob` or `RejectJob`, before
	// sending the next job. The worker is considered available to accept jobs
	// as long as the stream is open. This may return an error with a `NotFound`
	// status code if the currently running job no longer exists.
	AcceptJobs(*AcceptJobsRequest, JobQueueWorkerService_AcceptJobsServer) error
	// Completes a job.
	CompleteJob(context.Context, *CompleteJobRequest) (*emptypb.Empty, error)
	// Rejects a job.
	RejectJob(context.Context, *RejectJobRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

JobQueueWorkerServiceServer is the server API for JobQueueWorkerService service. All implementations must embed UnimplementedJobQueueWorkerServiceServer for forward compatibility

type JobQueueWorkerService_AcceptJobsClient

type JobQueueWorkerService_AcceptJobsClient interface {
	Recv() (*AcceptJobsResponse, error)
	grpc.ClientStream
}

type JobQueueWorkerService_AcceptJobsServer

type JobQueueWorkerService_AcceptJobsServer interface {
	Send(*AcceptJobsResponse) error
	grpc.ServerStream
}

type RejectJobRequest

type RejectJobRequest struct {

	// The identifier of the job.
	JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
	// contains filtered or unexported fields
}

Represents a request to the `RejectJob` method.

func (*RejectJobRequest) Descriptor deprecated

func (*RejectJobRequest) Descriptor() ([]byte, []int)

Deprecated: Use RejectJobRequest.ProtoReflect.Descriptor instead.

func (*RejectJobRequest) GetJobId

func (x *RejectJobRequest) GetJobId() string

func (*RejectJobRequest) ProtoMessage

func (*RejectJobRequest) ProtoMessage()

func (*RejectJobRequest) ProtoReflect

func (x *RejectJobRequest) ProtoReflect() protoreflect.Message

func (*RejectJobRequest) Reset

func (x *RejectJobRequest) Reset()

func (*RejectJobRequest) String

func (x *RejectJobRequest) String() string

type UnimplementedJobQueueWorkerServiceServer

type UnimplementedJobQueueWorkerServiceServer struct {
}

UnimplementedJobQueueWorkerServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedJobQueueWorkerServiceServer) AcceptJobs

func (UnimplementedJobQueueWorkerServiceServer) CompleteJob

func (UnimplementedJobQueueWorkerServiceServer) RejectJob

type UnsafeJobQueueWorkerServiceServer

type UnsafeJobQueueWorkerServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeJobQueueWorkerServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to JobQueueWorkerServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL