s3

package
v0.3.4 Latest Latest
Warning

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

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

Documentation

Overview

Package s3 stores objects in an S3-compatible service: Amazon S3, DigitalOcean Spaces, Cloudflare R2 or MinIO (ADR-0075), through the MinIO client. Signed URLs are the service's presigned URLs.

Stability: experimental (ADR-0054).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Driver names the service for operators: s3, spaces, r2 or minio.
	Driver string
	// Endpoint is the service's host, without a scheme: s3.amazonaws.com,
	// nyc3.digitaloceanspaces.com, <account>.r2.cloudflarestorage.com,
	// 127.0.0.1:9000 for MinIO.
	Endpoint  string
	Region    string
	Bucket    string
	AccessKey string
	SecretKey config.Secret
	// UseSSL is on for every service but a local MinIO.
	UseSSL bool
	// PathStyle addresses the bucket in the path (MinIO) rather than the
	// host.
	PathStyle bool
	// PublicURL is where the bucket's objects are reachable when public.
	PublicURL string
}

Config connects to a service.

type Store

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

Store is an S3-compatible storage.Store.

func New

func New(cfg Config) (*Store, error)

New connects to the service; it doesn't check the bucket (Ping does).

func (*Store) Copy

func (s *Store) Copy(ctx context.Context, src, dst string) (storage.Object, error)

Copy implements storage.Store.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key string) error

Delete implements storage.Store.

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) (io.ReadCloser, storage.Object, error)

Get implements storage.Store.

func (*Store) Info

func (s *Store) Info() storage.Info

Info implements storage.Store.

func (*Store) List

func (s *Store) List(ctx context.Context, opts storage.ListOptions) (storage.Page, error)

List implements storage.Store. The cursor is the last key of the previous page (S3's StartAfter).

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping implements storage.Store: the bucket must exist.

func (*Store) Put

func (s *Store) Put(ctx context.Context, key string, r io.Reader, size int64, opts storage.PutOptions) (storage.Object, error)

Put implements storage.Store. size may be -1 when unknown.

func (*Store) SignedURL

func (s *Store) SignedURL(ctx context.Context, key, method string, expiry time.Duration) (string, error)

SignedURL implements storage.Store with a presigned URL.

func (*Store) Stat

func (s *Store) Stat(ctx context.Context, key string) (storage.Object, error)

Stat implements storage.Store.

Jump to

Keyboard shortcuts

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