gcs

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

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

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 New

func New(ctx context.Context, opts Options, logger *slog.Logger) (*Backend, error)

New builds a GCS backend using ADC (or no auth when pointed at an emulator endpoint).

func (*Backend) Get

func (b *Backend) Get(ctx context.Context, key string) (io.ReadCloser, error)

Get opens key for reading (read-only). Caller closes the reader.

func (*Backend) List

func (b *Backend) List(ctx context.Context, prefix string) ([]dest.Object, error)

List returns objects under prefix (read-only).

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

func (b *Backend) VerifyWorm(ctx context.Context) (dest.WormStatus, error)

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).

Jump to

Keyboard shortcuts

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