s3

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeWriterAt

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

FakeWriterAt represents a struct that provides the method WriteAt so it will satisfy interface io.WriterAt. It will ignore offset and therefore works like just io.Writer. AWS SDK is Using io.WriterAt because of concurrent download, so it can write at offset position (e.g. in middle of file). By disabling concurrent download we can safely ignore the offset argument because it will be downloaded sequentially.

func (FakeWriterAt) WriteAt

func (fw FakeWriterAt) WriteAt(p []byte, offset int64) (n int, err error)

type Service

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

Service provides abstraction to cloud object storage.

func New

func New(region, accessKey, secretKey string) (Service, error)

New generates new s3 object storage service.

func (Service) Delete added in v0.5.0

func (s Service) Delete(ctx context.Context, bucket, key string) (bool, error)

Delete removes an object from the store.

func (Service) Download

func (s Service) Download(ctx context.Context, bucket, key string,
	file io.Writer) error

Download downloads an object from s3.

func (Service) Exists added in v0.3.0

func (s Service) Exists(ctx context.Context, bucketName,
	key string) (bool, error)

func (Service) GeneratePresignedURL added in v0.5.0

func (s Service) GeneratePresignedURL(ctx context.Context, bucketName, key string) (string, error)

func (Service) MakeBucket

func (s Service) MakeBucket(ctx context.Context, bucketName, location string) error

MakeBucket creates a new bucket in s2.

func (Service) Upload

func (s Service) Upload(ctx context.Context, bucket, key string,
	file io.Reader) error

Upload upload an object to s3.

Jump to

Keyboard shortcuts

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