Documentation
¶
Overview ¶
Package resource encodes GCP resources as store keys.
The encoding decides what a prefix scan can express, so it is here rather than inside a service: listing, delimiter rollup and reset-by-project are all prefix operations over these keys.
Index ¶
- func BlobRefs(sha string) string
- func Bucket(project, bucket string) string
- func BucketIndex(bucket string) string
- func BucketPrefix(project, bucket string) string
- func BucketsPrefix(project string) string
- func IAM(project, bucket, object string) string
- func Live(project, bucket, object string) string
- func LivePrefix(project, bucket string) string
- func Object(project, bucket, object string, generation int64) string
- func ObjectName(project, bucket, liveKey string) (string, error)
- func ObjectPrefix(project, bucket, object string) string
- func ParseObject(key string) (project, bucket, object string, generation int64, err error)
- func ProjectPrefix(project string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlobRefs ¶
BlobRefs is the key counting how many generations reference a blob.
Blobs are content-addressed, so two objects with identical bytes share one file. Dropping a generation may not remove it until nothing else points at it, and a count is what says so.
func BucketIndex ¶
BucketIndex maps a bucket name to its project.
GCS bucket names are globally unique and object URLs carry no project, so a request naming only a bucket has to resolve one. The index lives outside the per-project tree because that is exactly what it exists to look up.
func BucketPrefix ¶
BucketPrefix is the prefix covering everything in a bucket, its own metadata key included.
func BucketsPrefix ¶
BucketsPrefix covers a project's bucket metadata keys. A key under it holding a further slash belongs to a bucket's contents, not to the bucket itself.
func IAM ¶
IAM is the key holding a resource's IAM policy. An empty object means the bucket's own policy.
func Live ¶
Live is the key of the pointer to an object's current generation.
p/{project}/b/{bucket}/live/{name}
func LivePrefix ¶
LivePrefix covers every live pointer in a bucket. Listing walks these, not the generation keys: one entry per visible object.
func Object ¶
Object is the key of one generation's metadata.
p/{project}/b/{bucket}/o/{name}\x00{generation:020d}
func ObjectName ¶
ObjectName recovers the object name from a live-pointer key.
func ObjectPrefix ¶
ObjectPrefix covers every generation of one object, in generation order.
func ParseObject ¶
ParseObject splits an object key back into its parts.
func ProjectPrefix ¶
ProjectPrefix covers every bucket in a project, so reset-by-project is one prefix delete rather than a scan.
Types ¶
This section is empty.