# Packages
Package tasks contains task queue tasks definitions.
# Functions
AttachMetadata transactionally attaches metadata to an instance.
AttachTags transactionally attaches a bunch of tags to an instance.
CheckInstanceExists fetches the instance and verifies it exists.
CheckInstanceReady fetches the instance and verifies it exists and has zero pending or failed processors.
CheckPackageExists verifies the package exists.
CheckPackages given a list of package names returns packages that exist, in the order they are listed in the list.
DeletePackage deletes all entities associated with a package.
DeleteRef removes the ref if it exists.
DetachMetadata detaches a bunch of metadata entries from an instance.
DetachTags detaches a bunch of tags from an instance.
EmitEvent adds a single event to the event log.
EmitMetadataEvents compares two metadatum of a prefix and emits events for fields that have changed.
FetchProcessors fetches results of all processors assigned to the instance and returns them as cipd.Processor proto messages (sorted by processor ID).
GetRef fetches the given ref.
IsTextContentType checks the metadata content type against a list of known-good values.
ListInstanceRefs returns all refs that point to a particular instance, most recently modified first.
ListInstances lists instances of a package, more recent first.
ListInstanceTags returns all tags attached to an instance, sorting them by the tag key first, and then by the timestamp (most recent first).
ListMetadata lists all instance metadata.
ListMetadataWithKeys lists instance metadata with any of the given keys.
ListPackageRefs returns all refs in a package, most recently modified first.
ListPackages returns a list of names of packages under the given prefix.
NewBigQueryEventLogger constructs a logger that writes to the given project.
NewEventsQuery returns an unfiltered query for Event entities.
PackageKey returns a datastore key of some package, given its name.
QueryEvents fetches and deserializes all events matching the query, sorting them by timestamp (most recent first).
RegisterInstance transactionally registers an instance (and the corresponding package), if it isn't registered already.
ResolveTag searches for a given tag among all instances of the package and returns an ID of the instance the tag is attached to.
ResolveVersion takes a version identifier (an instance ID, a ref or a tag) and resolves it into a concrete package instance, ensuring it exists.
SearchInstances lists instances of a package with all given tags attached.
SetPackageHidden updates Hidden field of the package.
SetRef moves or creates a ref.
TagID calculates Tag entity ID (SHA1 digest) from the given tag.
Txn runs the callback in a datastore transaction, marking commit errors with transient tag.
# Constants
Hidden can be used in place of 'true' when working with Package.Hidden flag.
NoInstance is used in place of empty Instance field in Event entity, so that we can query for all events that are not associated with instances and only them (these are package-level events).
Visible can be used in place of 'false' when working with Package.Hidden flag.
# Variables
EventsEpoch is used to calculate timestamps used to order entities in the datastore.
# Structs
BigQueryEventLogger moves events from PubSub to BQ.
Event in a global structured event log.
Events collects events emitted in some transaction and then flushes them.
Instance represents a package instance as it is stored in the datastore.
InstanceMetadata represents one instance metadata entry.
Package represents a package as it is stored in the datastore.
ProcessingResult holds information extracted from the package instance file.
Ref represents a named pointer to some package instance.
Tag represents a "key:value" pair attached to some package instance.