Involved Source Files
Package queue provides queue implementations that can be used for
asynchronous scheduling of fetch actions.
Package-Level Type Names (total 5, in which 3 are exported)
/* sort exporteds by: | */
GCP provides a Queue implementation backed by the Google Cloud Tasks
API.
client*cloudtasks.Client
// full GCP name of the queue
// non-AppEngine URL to post tasks to
token holds information that lets the task queue construct an authorized request to the worker.
Since the worker sits behind the IAP, the queue needs an identity token that includes the
identity of a service account that has access, and the client ID for the IAP.
We use the service account of the current process.
ScheduleFetch enqueues a task on GCP to fetch the given modulePath and
version. It returns an error if there was an error hashing the task name, or
an error pushing the task to GCP. If the task was a duplicate, it returns (false, nil).
(*T) newTaskRequest(modulePath, version, suffix string, disableProxyFetch bool) *taskspb.CreateTaskRequest
*T : Queue
func newGCP(cfg *config.Config, client *cloudtasks.Client, queueID string) (_ *GCP, err error)
InMemory is a Queue implementation that schedules in-process fetch
operations. Unlike the GCP task queue, it will not automatically retry tasks
on failure.
This should only be used for local development.
experiments[]stringqueuechan moduleVersionsemchan struct{}
ScheduleFetch pushes a fetch task into the local queue to be processed
asynchronously.
WaitForTesting waits for all queued requests to finish. It should only be
used by test code.
*T : Queue
func NewInMemory(ctx context.Context, workerCount int, experiments []string, processFunc inMemoryProcessFunc) *InMemory
Package-Level Functions (total 4, in which 2 are exported)
New creates a new Queue with name queueName based on the configuration
in cfg. When running locally, Queue uses numWorkers concurrent workers.
NewInMemory creates a new InMemory that asynchronously fetches
from proxyClient and stores in db. It uses workerCount parallelism to
execute these fetches.
NewGCP returns a new Queue that can be used to enqueue tasks using the
cloud tasks API. The given queueID should be the name of the queue in the
cloud tasks console.
Create a task ID for the given module path and version.
Task IDs can contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or underscores (_).
Package-Level Constants (total 3, in which 2 are exported)
Maximum timeout for HTTP tasks.
See https://cloud.google.com/tasks/docs/creating-http-target-tasks.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.