s3

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*s3Options)

Option configures an S3 store.

func WithCredentials

func WithCredentials(accessKey, secretKey string) Option

WithCredentials sets static AWS credentials. When omitted the SDK default credential chain is used (env vars, shared config, IAM role, etc.).

func WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint sets a custom S3-compatible endpoint URL (e.g. MinIO, Cloudflare R2). Path-style addressing is automatically enabled when an endpoint is set.

func WithPrefix

func WithPrefix(prefix string) Option

WithPrefix sets a key prefix prepended to every object key. Use this to isolate multiple repositories within a single bucket.

func WithProfile

func WithProfile(profile string) Option

WithProfile sets the AWS shared config profile name used by the SDK default credential chain (e.g. profile from ~/.aws/config).

func WithRegion

func WithRegion(region string) Option

WithRegion sets the AWS region for the bucket (e.g. "us-east-1").

func WithS3Client

func WithS3Client(client *s3.Client) Option

WithS3Client provides a pre-configured S3 client, skipping internal client creation. When set, credential, region, and endpoint options are ignored.

type Store

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

Store implements store.ObjectStore for Amazon S3 and compatible services.

func New

func New(ctx context.Context, bucketName string, opts ...Option) (*Store, error)

func (*Store) ConcurrencyHint

func (s *Store) ConcurrencyHint() int

ConcurrencyHint implements ConcurrencyHinter. S3 benefits from highly parallel uploads since each PUT is a separate HTTP round-trip.

func (*Store) Delete

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

func (*Store) Exists

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

func (*Store) Flush

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

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string) ([]byte, error)

func (*Store) GetRange

func (s *Store) GetRange(ctx context.Context, key string, offset, length int64) ([]byte, error)

GetRange implements RangeGetter using an HTTP range request, so a caller reading a packfile footer transfers a few hundred bytes instead of the whole 8 MB object.

func (*Store) List

func (s *Store) List(ctx context.Context, prefix string) ([]string, error)

func (*Store) Put

func (s *Store) Put(ctx context.Context, key string, data []byte) error

func (*Store) Size

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

func (*Store) TotalSize

func (s *Store) TotalSize(ctx context.Context) (int64, error)

Jump to

Keyboard shortcuts

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