# README
go-workqueue
This is a Go library that can be used to queue and process work with a number of properties reminiscient of Kubernetes Controller's workqueue, but that support being backed by durable storage (e.g. GCS, S3).
Given a workqueue.Interface
new keys can be added to the queue with
deduplication by simply calling Queue(ctx, key)
. For example:
func foo(ctx context.Context, wq workqueue.Interface) error {
if err := wq.Queue(ctx, "foo"); err != nil {
return err
}
if err := wq.Queue(ctx, "bar"); err != nil {
return err
}
if err := wq.Queue(ctx, "baz"); err != nil {
return err
}
return nil
}
Up to N
items of concurrent work may be processed from the workqueue by
invoking the Handle
method in the
github.com/chainguard-dev/go-workqueue/dispatcher
package. For example:
if err := dispatcher.Handle(ctx, wq, N, func(ctx context.Context, key string) error {
// Process the key!
clog.InfoContextf(ctx, "Got key: %s", key)
return nil
}); err != nil {
return err
}
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
# Variables
No description provided by the author
WorkqueueService_ServiceDesc is the grpc.ServiceDesc for WorkqueueService service.
# Structs
No description provided by the author
No description provided by the author
UnimplementedWorkqueueServiceServer must be embedded to have forward compatible implementations.
# Interfaces
No description provided by the author
InProgressKey is a shared interface that all in-progress key types must implement.
Interface is the interface that workqueue implementations must implement.
Key is a shared interface that all key types must implement.
ObservedInProgressKey is a key that we have observed to be in progress, but that we are not the owner of.
OwnedInProgressKey is an in-progress key where we have initiated the work, and own until it completes either successfully (Complete), or unsuccessfully (Requeue).
QueuedKey is a key that is in the queue, waiting to be processed.
UnsafeWorkqueueServiceServer may be embedded to opt out of forward compatibility for this service.
WorkqueueServiceClient is the client API for WorkqueueService service.
WorkqueueServiceServer is the server API for WorkqueueService service.