storage

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(c *cli.Context, uploader Uploader, log logger.Logger) error

func Prune

func Prune(c *cli.Context, uploader Uploader, log logger.Logger) error

func Upload

func Upload(c *cli.Context, uploader Uploader, log logger.Logger) error

Types

type B2Uploader

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

func NewB2Uploader

func NewB2Uploader(bucket string) (*B2Uploader, error)

func (*B2Uploader) Delete

func (u *B2Uploader) Delete(ctx context.Context, key string) error

func (*B2Uploader) Download

func (u *B2Uploader) Download(ctx context.Context, key string, writer io.Writer) error

func (*B2Uploader) FileExists

func (u *B2Uploader) FileExists(ctx context.Context, key string) (bool, error)

func (*B2Uploader) GetFileInfo

func (u *B2Uploader) GetFileInfo(ctx context.Context, key string) (*FileInfo, error)

func (*B2Uploader) List

func (u *B2Uploader) List(ctx context.Context, prefix string) ([]string, error)

func (*B2Uploader) Upload

func (u *B2Uploader) Upload(ctx context.Context, key string, reader io.Reader, size int64) error

type FileInfo

type FileInfo struct {
	LastModified time.Time
	Size         int64
}

type R2Uploader

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

func NewR2Uploader

func NewR2Uploader(bucket string) (*R2Uploader, error)

func (*R2Uploader) Delete

func (u *R2Uploader) Delete(ctx context.Context, key string) error

func (*R2Uploader) Download

func (u *R2Uploader) Download(ctx context.Context, key string, writer io.Writer) error

func (*R2Uploader) FileExists

func (u *R2Uploader) FileExists(ctx context.Context, key string) (bool, error)

func (*R2Uploader) GetFileInfo

func (u *R2Uploader) GetFileInfo(ctx context.Context, key string) (*FileInfo, error)

func (*R2Uploader) List

func (u *R2Uploader) List(ctx context.Context, prefix string) ([]string, error)

func (*R2Uploader) Upload

func (u *R2Uploader) Upload(ctx context.Context, key string, reader io.Reader, size int64) error

type S3Uploader

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

func NewS3Uploader

func NewS3Uploader(region, bucket string) (*S3Uploader, error)

func (*S3Uploader) Delete

func (u *S3Uploader) Delete(ctx context.Context, key string) error

func (*S3Uploader) Download

func (u *S3Uploader) Download(ctx context.Context, key string, writer io.Writer) error

func (*S3Uploader) FileExists

func (u *S3Uploader) FileExists(ctx context.Context, key string) (bool, error)

func (*S3Uploader) GetFileInfo

func (u *S3Uploader) GetFileInfo(ctx context.Context, key string) (*FileInfo, error)

func (*S3Uploader) List

func (u *S3Uploader) List(ctx context.Context, prefix string) ([]string, error)

func (*S3Uploader) Upload

func (u *S3Uploader) Upload(ctx context.Context, key string, reader io.Reader, size int64) error

type Uploader

type Uploader interface {
	Upload(ctx context.Context, key string, reader io.Reader, size int64) error
	Download(ctx context.Context, key string, writer io.Writer) error
	List(ctx context.Context, prefix string) ([]string, error)
	Delete(ctx context.Context, key string) error
	FileExists(ctx context.Context, key string) (bool, error)
	GetFileInfo(ctx context.Context, key string) (*FileInfo, error)
}

Jump to

Keyboard shortcuts

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