Documentation
¶
Overview ¶
Package gcs implements the create-only Destination for Google Cloud Storage. WORM is a locked bucket retention policy (Bucket Lock); writes are create-only and inherit it. Auth uses Application Default Credentials. There is no delete path.
Index ¶
- type Backend
- func (b *Backend) Get(ctx context.Context, key string) (io.ReadCloser, error)
- func (b *Backend) List(ctx context.Context, prefix string) ([]dest.Object, error)
- func (b *Backend) ObserveRetention(ctx context.Context, key string) (dest.RetentionObservation, time.Time, error)
- func (b *Backend) PutImmutable(ctx context.Context, key string, r io.Reader, _ int64, _ dest.Retention) (dest.PutResult, error)
- func (b *Backend) VerifyWorm(ctx context.Context) (dest.WormStatus, error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is a create-only GCS Destination.
func (*Backend) ObserveRetention ¶ added in v0.1.16
func (b *Backend) ObserveRetention(ctx context.Context, key string) (dest.RetentionObservation, time.Time, error)
ObserveRetention asks Cloud Storage what retention is on an object gitdr wrote.
The native backend is the one case where the write itself already answers this - PutImmutable records `RetentionExpirationTime` off the returned attributes - so this re-reads the object rather than trusting a value carried from the write, which is the whole point of the check.
`RetentionExpirationTime` is the bucket retention policy's expiry for this object. A zero value from a successful read is the store answering "nothing holds this object", which is an earned negative. A failed read says nothing and must not be read as one.
func (*Backend) PutImmutable ¶
func (b *Backend) PutImmutable(ctx context.Context, key string, r io.Reader, _ int64, _ dest.Retention) (dest.PutResult, error)
PutImmutable creates key. Create-only via the DoesNotExist precondition; immutability is enforced by the bucket's locked retention policy. Never overwrites, never deletes.
func (*Backend) VerifyWorm ¶
VerifyWorm requires a locked bucket retention policy. An unlocked or absent policy is reported as not-locked so the operator can override.
type Options ¶
type Options struct {
Bucket string
Endpoint string // empty = real GCS; set for an emulator, e.g. http://host:4443/storage/v1/
}
Options configures the GCS backend. Credentials come from ADC (not set here).