storage

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package storage provides a portable storage bucket API with cross-cutting concerns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	// contains filtered or unexported fields
}

Bucket is the portable storage type wrapping a driver with cross-cutting concerns.

func NewBucket

func NewBucket(d driver.Bucket, opts ...Option) *Bucket

NewBucket creates a new portable Bucket wrapping the given driver.

func (*Bucket) CopyObject

func (b *Bucket) CopyObject(ctx context.Context, dstBucket, dstKey string, src driver.CopySource) error

CopyObject copies an object between buckets.

func (*Bucket) CreateBucket

func (b *Bucket) CreateBucket(ctx context.Context, name string) error

CreateBucket creates a new storage bucket.

func (*Bucket) DeleteBucket

func (b *Bucket) DeleteBucket(ctx context.Context, name string) error

DeleteBucket deletes a storage bucket.

func (*Bucket) DeleteObject

func (b *Bucket) DeleteObject(ctx context.Context, bucket, key string) error

DeleteObject deletes an object from a bucket.

func (*Bucket) GetObject

func (b *Bucket) GetObject(ctx context.Context, bucket, key string) (*driver.Object, error)

GetObject retrieves an object from a bucket.

func (*Bucket) HeadObject

func (b *Bucket) HeadObject(ctx context.Context, bucket, key string) (*driver.ObjectInfo, error)

HeadObject retrieves object metadata without the body.

func (*Bucket) ListBuckets

func (b *Bucket) ListBuckets(ctx context.Context) ([]driver.BucketInfo, error)

ListBuckets lists all buckets.

func (*Bucket) ListObjects

func (b *Bucket) ListObjects(ctx context.Context, bucket string, opts driver.ListOptions) (*driver.ListResult, error)

ListObjects lists objects in a bucket.

func (*Bucket) PutObject

func (b *Bucket) PutObject(ctx context.Context, bucket, key string, data []byte, contentType string, metadata map[string]string) error

PutObject stores an object in a bucket.

type Option

type Option func(*Bucket)

Option configures a portable Bucket.

func WithErrorInjection

func WithErrorInjection(i *inject.Injector) Option

WithErrorInjection sets the error injector.

func WithLatency

func WithLatency(d time.Duration) Option

WithLatency sets simulated latency.

func WithMetrics

func WithMetrics(m *metrics.Collector) Option

WithMetrics sets the metrics collector.

func WithRateLimiter

func WithRateLimiter(l *ratelimit.Limiter) Option

WithRateLimiter sets the rate limiter.

func WithRecorder

func WithRecorder(r *recorder.Recorder) Option

WithRecorder sets the recorder.

Directories

Path Synopsis
Package driver defines the interface for storage service implementations.
Package driver defines the interface for storage service implementations.

Jump to

Keyboard shortcuts

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