storage

package
v0.1.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 22 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 B2S3Uploader

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

func NewB2S3Uploader

func NewB2S3Uploader(region, bucket string, log logger.Logger) (*B2S3Uploader, error)

func (*B2S3Uploader) Delete

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

func (*B2S3Uploader) Download

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

func (*B2S3Uploader) FileExists

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

func (*B2S3Uploader) GetFileInfo

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

func (*B2S3Uploader) List

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

func (*B2S3Uploader) Upload

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

type B2Uploader

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

func NewB2Uploader

func NewB2Uploader(bucket string, log logger.Logger) (*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
}

FileInfo represents metadata about a file in cloud storage

type R2Uploader

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

func NewR2Uploader

func NewR2Uploader(bucket string, log logger.Logger) (*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, log logger.Logger) (*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 SFTPUploader

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

func NewSFTPUploader

func NewSFTPUploader(host string, port int, username, basePath string, log logger.Logger) (*SFTPUploader, error)

func (*SFTPUploader) Close

func (u *SFTPUploader) Close() error

func (*SFTPUploader) Delete

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

func (*SFTPUploader) Download

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

func (*SFTPUploader) FileExists

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

func (*SFTPUploader) GetFileInfo

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

func (*SFTPUploader) List

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

func (*SFTPUploader) Upload

func (u *SFTPUploader) 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)
}

type UserError

type UserError struct {
	Message string
	Cause   error
}

UserError represents a user-friendly error message

func (*UserError) Error

func (e *UserError) Error() string

func (*UserError) Unwrap

func (e *UserError) Unwrap() error

Jump to

Keyboard shortcuts

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