Documentation ¶
Overview ¶
The purge-cache service is responsible for tracking cache-purge requests.
User create purge requests for specific caches on specific workers, and these requests are timestamped. Workers consult the service before starting a new task, and purge any caches older than the timestamp.
See:
How to use this package ¶
First create a PurgeCache object:
purgeCache := tcpurgecache.New(nil)
and then call one or more of purgeCache's methods, e.g.:
err := purgeCache.Ping(.....)
handling any errors...
if err != nil { // handle error... }
Taskcluster Schema ¶
The source code of this go package was auto-generated from the API definition at https://taskcluster-staging.net/references/purge-cache/v1/api.json together with the input and output schemas it references, downloaded on Thu, 27 Jun 2019 at 07:22:00 UTC. The code was generated by https://github.com/taskcluster/taskcluster-client-go/blob/master/build.sh.
Index ¶
- type OpenAllPurgeRequestsList
- type OpenPurgeRequestList
- type PurgeCache
- func (purgeCache *PurgeCache) AllPurgeRequests(continuationToken, limit string) (*OpenAllPurgeRequestsList, error)
- func (purgeCache *PurgeCache) Ping() error
- func (purgeCache *PurgeCache) PurgeCache(provisionerId, workerType string, payload *PurgeCacheRequest) error
- func (purgeCache *PurgeCache) PurgeRequests(provisionerId, workerType, since string) (*OpenPurgeRequestList, error)
- type PurgeCacheRequest
- type PurgeCacheRequestsEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OpenAllPurgeRequestsList ¶
type OpenAllPurgeRequestsList struct { // Passed back from Azure to allow us to page through long result sets. // // See https://taskcluster-staging.net/schemas/purge-cache/v1/all-purge-cache-request-list.json#/properties/continuationToken ContinuationToken string `json:"continuationToken,omitempty"` // A list of Purge Cache requests that the Purge Cache service has previously received. // // See https://taskcluster-staging.net/schemas/purge-cache/v1/purge-cache-requests.json# Requests []PurgeCacheRequestsEntry `json:"requests"` }
A list of currently open purge-cache requests. Should not be used by workers.
See https://taskcluster-staging.net/schemas/purge-cache/v1/all-purge-cache-request-list.json#
type OpenPurgeRequestList ¶
type OpenPurgeRequestList struct { // A list of Purge Cache requests that the Purge Cache service has previously received. // // See https://taskcluster-staging.net/schemas/purge-cache/v1/purge-cache-requests.json# Requests []PurgeCacheRequestsEntry `json:"requests"` }
A list of currently open purge-cache requests.
See https://taskcluster-staging.net/schemas/purge-cache/v1/purge-cache-request-list.json#
type PurgeCache ¶
func New ¶
func New(credentials *tcclient.Credentials, rootURL string) *PurgeCache
New returns a PurgeCache client, configured to run against production. Pass in nil credentials to create a client without authentication. The returned client is mutable, so returned settings can be altered.
purgeCache := tcpurgecache.New( nil, // client without authentication "http://localhost:1234/my/taskcluster", // taskcluster hosted at this root URL on local machine ) err := purgeCache.Ping(.....) // for example, call the Ping(.....) API endpoint (described further down)... if err != nil { // handle errors... }
func NewFromEnv ¶
func NewFromEnv() *PurgeCache
NewFromEnv returns a *PurgeCache configured from environment variables.
The root URL is taken from TASKCLUSTER_PROXY_URL if set to a non-empty string, otherwise from TASKCLUSTER_ROOT_URL if set, otherwise the empty string.
The credentials are taken from environment variables:
TASKCLUSTER_CLIENT_ID TASKCLUSTER_ACCESS_TOKEN TASKCLUSTER_CERTIFICATE
If TASKCLUSTER_CLIENT_ID is empty/unset, authentication will be disabled.
func (*PurgeCache) AllPurgeRequests ¶
func (purgeCache *PurgeCache) AllPurgeRequests(continuationToken, limit string) (*OpenAllPurgeRequestsList, error)
View all active purge requests.
This is useful mostly for administors to view the set of open purge requests. It should not be used by workers. They should use the purgeRequests endpoint that is specific to their workerType and provisionerId.
See #allPurgeRequests
func (*PurgeCache) Ping ¶
func (purgeCache *PurgeCache) Ping() error
Respond without doing anything. This endpoint is used to check that the service is up.
See #ping
func (*PurgeCache) PurgeCache ¶
func (purgeCache *PurgeCache) PurgeCache(provisionerId, workerType string, payload *PurgeCacheRequest) error
Publish a request to purge caches named `cacheName` with on `provisionerId`/`workerType` workers.
If such a request already exists, its `before` timestamp is updated to the current time.
Required scopes:
purge-cache:<provisionerId>/<workerType>:<cacheName>
See #purgeCache
func (*PurgeCache) PurgeRequests ¶
func (purgeCache *PurgeCache) PurgeRequests(provisionerId, workerType, since string) (*OpenPurgeRequestList, error)
List the caches for this `provisionerId`/`workerType` that should to be purged if they are from before the time given in the response.
This is intended to be used by workers to determine which caches to purge.
See #purgeRequests
type PurgeCacheRequest ¶
type PurgeCacheRequest struct { // Name of cache to purge. Notice that if a `workerType` have multiple kinds // of caches (with independent names), it should purge all caches identified // by `cacheName` regardless of cache type. // // See https://taskcluster-staging.net/schemas/purge-cache/v1/purge-cache-request.json#/properties/cacheName CacheName string `json:"cacheName"` }
Request that a message be published to purge a specific cache.
See https://taskcluster-staging.net/schemas/purge-cache/v1/purge-cache-request.json#
type PurgeCacheRequestsEntry ¶
type PurgeCacheRequestsEntry struct { // All caches that match this provisionerId, workerType, and cacheName must be destroyed if they were created _before_ this time. // // See https://taskcluster-staging.net/schemas/purge-cache/v1/purge-cache-requests.json#/items/properties/before Before tcclient.Time `json:"before"` // Name of cache to purge. // // See https://taskcluster-staging.net/schemas/purge-cache/v1/purge-cache-requests.json#/items/properties/cacheName CacheName string `json:"cacheName"` // ProvisionerId associated with the workerType. // // Syntax: ^([a-zA-Z0-9-_]*)$ // Min length: 1 // Max length: 38 // // See https://taskcluster-staging.net/schemas/purge-cache/v1/purge-cache-requests.json#/items/properties/provisionerId ProvisionerID string `json:"provisionerId"` // Workertype cache exists on. // // Syntax: ^([a-zA-Z0-9-_]*)$ // Min length: 1 // Max length: 38 // // See https://taskcluster-staging.net/schemas/purge-cache/v1/purge-cache-requests.json#/items/properties/workerType WorkerType string `json:"workerType"` }
An entry in a list of Purge Cache Requests that the Purge Cache service has previously received.
See https://taskcluster-staging.net/schemas/purge-cache/v1/purge-cache-requests.json#/items