s3

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsComposeUnsupported added in v0.2.0

func IsComposeUnsupported(err error) bool

func IsNoSuchKey

func IsNoSuchKey(err error) bool

Types

type Client

type Client interface {
	Upload(context.Context, string, []byte) (string, error)
	Download(context.Context, string) ([]byte, error)
	DownloadRange(context.Context, string, string, int64, int64) ([]byte, error)
	List(context.Context, string) iter.Seq2[Object, error]
	Stat(context.Context, string) (Object, error)
	Delete(context.Context, string) error
	Compose(context.Context, string, []s3lib.CopyPart) (string, error)
}

func NewClient

func NewClient(cfg Config) (client Client, err error)

func NewMockClient

func NewMockClient(server *s3mock.Server, cfg Config) (Client, error)

NewMockClient creates a new S3 client configured to use the mock server.

type Config

type Config struct {
	Bucket  string
	Region  string
	Prefix  string
	Service string
	Key     *aws.SigningKey
}

func NewMockConfig

func NewMockConfig(_ *s3mock.Server, bucket, prefix string) Config

NewMockConfig creates a Config pointing to the mock server.

type ErrS3Operation

type ErrS3Operation struct {
	Operation string
	Err       error
}

func (ErrS3Operation) Error

func (e ErrS3Operation) Error() string

func (ErrS3Operation) Unwrap

func (e ErrS3Operation) Unwrap() error

type Object added in v0.2.0

type Object struct {
	Key  string
	ETag string
	Size int64
	Dir  bool
}

type S3Client

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

func (*S3Client) Compose added in v0.2.0

func (c *S3Client) Compose(ctx context.Context, key string, parts []s3lib.CopyPart) (string, error)

func (*S3Client) Delete added in v0.2.0

func (c *S3Client) Delete(ctx context.Context, key string) error

func (*S3Client) Download

func (c *S3Client) Download(ctx context.Context, key string) ([]byte, error)

func (*S3Client) DownloadRange

func (c *S3Client) DownloadRange(ctx context.Context, key, etag string, offset, size int64) ([]byte, error)

func (*S3Client) List added in v0.2.0

func (c *S3Client) List(ctx context.Context, prefix string) iter.Seq2[Object, error]

func (*S3Client) Stat added in v0.2.0

func (c *S3Client) Stat(ctx context.Context, key string) (Object, error)

func (*S3Client) Upload

func (c *S3Client) Upload(ctx context.Context, key string, data []byte) (string, error)

Jump to

Keyboard shortcuts

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