objectstore

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package objectstore manages the existence of the objects an external snapshot is made of: listing them, copying them, and deleting them once nothing owns them any more.

It is deliberately separate from atelet's ategcs, which reads and writes snapshot content. The control plane never handles those bytes: it copies server-side and deletes by name, so a multi-gigabyte memory image never transits ate-api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BucketPrefix

func BucketPrefix(uri resources.StoragePrefix) (string, string, error)

BucketPrefix splits a storage prefix into the bucket and the object-name prefix its objects share. The prefix keeps its trailing separator so that it cannot match a sibling whose name it happens to prefix.

func CopyPrefix

func CopyPrefix(ctx context.Context, s Store, src, dst resources.StoragePrefix) error

CopyPrefix copies every object of the external snapshot at src to dst, keeping each object's name relative to the prefix. The destination is deterministic, so a retry of a partly-completed copy overwrites what it already wrote instead of leaving a second copy behind.

func DeletePrefix

func DeletePrefix(ctx context.Context, s Store, uri resources.StoragePrefix) error

DeletePrefix removes every object under uri: one external snapshot, or every snapshot an owner holds. A prefix with no objects left is already collected, so it succeeds.

Types

type Store

type Store interface {
	// List returns the full names of the objects under prefix in bucket.
	List(ctx context.Context, bucket, prefix string) ([]string, error)
	// Delete removes one object. Deleting an object that is already gone
	// succeeds, so a retry over a partly-collected snapshot finishes cleanly.
	Delete(ctx context.Context, bucket, object string) error
	// Copy copies one object server-side. The destination is overwritten if it
	// exists, so a retry re-copying it is harmless.
	Copy(ctx context.Context, srcBucket, srcObject, dstBucket, dstObject string) error
}

Store is the object-storage surface the control plane needs. Every method addresses objects by name only.

func NewGCS

func NewGCS(client *storage.Client) Store

NewGCS returns a Store backed by Google Cloud Storage.

func NewS3

func NewS3(client *s3.Client) Store

NewS3 returns a Store backed by an S3-compatible object store.

Directories

Path Synopsis
Package objectstoretest provides an in-memory objectstore.Store for tests that need to observe which external snapshots a flow created and released.
Package objectstoretest provides an in-memory objectstore.Store for tests that need to observe which external snapshots a flow created and released.

Jump to

Keyboard shortcuts

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