s3

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 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)
	UploadReader(context.Context, string, io.ReaderAt, int64) (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 MultiReader

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

MultiReader implements io.ReaderAt for multiple byte slices concatenated together. This avoids expensive memory allocations and copies when combining multiple data sources.

func NewMultiReader

func NewMultiReader(sections ...[]byte) *MultiReader

NewMultiReader creates a new MultiReaderAt from multiple byte slices.

func (*MultiReader) ReadAt

func (m *MultiReader) ReadAt(p []byte, off int64) (n int, err error)

ReadAt implements io.ReaderAt interface.

func (*MultiReader) Size

func (m *MultiReader) Size() int64

Size returns the total size of all sections combined.

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)

func (*S3Client) UploadReader

func (c *S3Client) UploadReader(ctx context.Context, key string, reader io.ReaderAt, size int64) (string, error)

Jump to

Keyboard shortcuts

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