resource

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 3 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlobRefs

func BlobRefs(sha string) string

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 Bucket

func Bucket(project, bucket string) string

Bucket is the key holding a bucket's metadata.

p/{project}/b/{bucket}

func BucketIndex

func BucketIndex(bucket string) string

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

func BucketPrefix(project, bucket string) string

BucketPrefix is the prefix covering everything in a bucket, its own metadata key included.

func BucketsPrefix

func BucketsPrefix(project string) string

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

func IAM(project, bucket, object string) string

IAM is the key holding a resource's IAM policy. An empty object means the bucket's own policy.

func Live

func Live(project, bucket, object string) string

Live is the key of the pointer to an object's current generation.

p/{project}/b/{bucket}/live/{name}

func LivePrefix

func LivePrefix(project, bucket string) string

LivePrefix covers every live pointer in a bucket. Listing walks these, not the generation keys: one entry per visible object.

func Object

func Object(project, bucket, object string, generation int64) string

Object is the key of one generation's metadata.

p/{project}/b/{bucket}/o/{name}\x00{generation:020d}

func ObjectName

func ObjectName(project, bucket, liveKey string) (string, error)

ObjectName recovers the object name from a live-pointer key.

func ObjectPrefix

func ObjectPrefix(project, bucket, object string) string

ObjectPrefix covers every generation of one object, in generation order.

func ParseObject

func ParseObject(key string) (project, bucket, object string, generation int64, err error)

ParseObject splits an object key back into its parts.

func ProjectPrefix

func ProjectPrefix(project string) string

ProjectPrefix covers every bucket in a project, so reset-by-project is one prefix delete rather than a scan.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL