Documentation ¶
Overview ¶
Package workqueue contains an interface for a simple key workqueue abstraction.
Index ¶
- Constants
- Variables
- func RegisterWorkqueueServiceServer(s grpc.ServiceRegistrar, srv WorkqueueServiceServer)
- type Client
- type InProgressKey
- type Interface
- type Key
- type ObservedInProgressKey
- type OwnedInProgressKey
- type ProcessRequest
- type ProcessResponse
- type QueuedKey
- type UnimplementedWorkqueueServiceServer
- type UnsafeWorkqueueServiceServer
- type WorkqueueServiceClient
- type WorkqueueServiceServer
Constants ¶
const (
WorkqueueService_Process_FullMethodName = "/chainguard.workqueue.WorkqueueService/Process"
)
Variables ¶
var File_workqueue_proto protoreflect.FileDescriptor
var WorkqueueService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "chainguard.workqueue.WorkqueueService", HandlerType: (*WorkqueueServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Process", Handler: _WorkqueueService_Process_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "workqueue.proto", }
WorkqueueService_ServiceDesc is the grpc.ServiceDesc for WorkqueueService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterWorkqueueServiceServer ¶
func RegisterWorkqueueServiceServer(s grpc.ServiceRegistrar, srv WorkqueueServiceServer)
Types ¶
type Client ¶
type Client interface { WorkqueueServiceClient Close() error }
func NewWorkqueueClient ¶
type InProgressKey ¶
type InProgressKey interface { Key // Requeue returns this key to the queue. Requeue(context.Context) error }
InProgressKey is a shared interface that all in-progress key types must implement.
type Interface ¶
type Interface interface { // Queue adds an item to the workqueue. Queue(ctx context.Context, key string) error // Enumerate returns: // - a list of all of the in-progress keys, and // - a list of the next "N" keys in the queue (according to its configured ordering), or // - an error if the workqueue is unable to enumerate the keys. Enumerate(ctx context.Context) ([]ObservedInProgressKey, []QueuedKey, error) }
Interface is the interface that workqueue implementations must implement.
type Key ¶
type Key interface { // Name is the name of the key. Name() string }
Key is a shared interface that all key types must implement.
type ObservedInProgressKey ¶
type ObservedInProgressKey interface { InProgressKey // IsOrphaned checks whether the key has been orphaned by it's owner. IsOrphaned() bool }
ObservedInProgressKey is a key that we have observed to be in progress, but that we are not the owner of.
type OwnedInProgressKey ¶
type OwnedInProgressKey interface { InProgressKey // Complete marks the key as successfully completed, and removes it from // the in-progress key set. Complete(context.Context) error // Context is the context of the process heartbeating the key. Context() context.Context }
OwnedInProgressKey is an in-progress key where we have initiated the work, and own until it completes either successfully (Complete), or unsuccessfully (Requeue).
type ProcessRequest ¶
type ProcessRequest struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
func (*ProcessRequest) Descriptor
deprecated
func (*ProcessRequest) Descriptor() ([]byte, []int)
Deprecated: Use ProcessRequest.ProtoReflect.Descriptor instead.
func (*ProcessRequest) GetKey ¶
func (x *ProcessRequest) GetKey() string
func (*ProcessRequest) ProtoMessage ¶
func (*ProcessRequest) ProtoMessage()
func (*ProcessRequest) ProtoReflect ¶
func (x *ProcessRequest) ProtoReflect() protoreflect.Message
func (*ProcessRequest) Reset ¶
func (x *ProcessRequest) Reset()
func (*ProcessRequest) String ¶
func (x *ProcessRequest) String() string
type ProcessResponse ¶
type ProcessResponse struct {
// contains filtered or unexported fields
}
func (*ProcessResponse) Descriptor
deprecated
func (*ProcessResponse) Descriptor() ([]byte, []int)
Deprecated: Use ProcessResponse.ProtoReflect.Descriptor instead.
func (*ProcessResponse) ProtoMessage ¶
func (*ProcessResponse) ProtoMessage()
func (*ProcessResponse) ProtoReflect ¶
func (x *ProcessResponse) ProtoReflect() protoreflect.Message
func (*ProcessResponse) Reset ¶
func (x *ProcessResponse) Reset()
func (*ProcessResponse) String ¶
func (x *ProcessResponse) String() string
type QueuedKey ¶
type QueuedKey interface { Key // Start initiates processing of the key, returning an OwnedInProgressKey // on success and an error on failure. Start(context.Context) (OwnedInProgressKey, error) }
QueuedKey is a key that is in the queue, waiting to be processed.
type UnimplementedWorkqueueServiceServer ¶
type UnimplementedWorkqueueServiceServer struct{}
UnimplementedWorkqueueServiceServer must 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.
func (UnimplementedWorkqueueServiceServer) Process ¶
func (UnimplementedWorkqueueServiceServer) Process(context.Context, *ProcessRequest) (*ProcessResponse, error)
type UnsafeWorkqueueServiceServer ¶
type UnsafeWorkqueueServiceServer interface {
// contains filtered or unexported methods
}
UnsafeWorkqueueServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WorkqueueServiceServer will result in compilation errors.
type WorkqueueServiceClient ¶
type WorkqueueServiceClient interface {
Process(ctx context.Context, in *ProcessRequest, opts ...grpc.CallOption) (*ProcessResponse, error)
}
WorkqueueServiceClient is the client API for WorkqueueService 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.
func NewWorkqueueServiceClient ¶
func NewWorkqueueServiceClient(cc grpc.ClientConnInterface) WorkqueueServiceClient
type WorkqueueServiceServer ¶
type WorkqueueServiceServer interface { Process(context.Context, *ProcessRequest) (*ProcessResponse, error) // contains filtered or unexported methods }
WorkqueueServiceServer is the server API for WorkqueueService service. All implementations must embed UnimplementedWorkqueueServiceServer for forward compatibility.