storage

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverFilesystem = "filesystem"
	DriverS3         = "s3"
)

Variables

View Source
var (
	ErrObjectNotFound     = errors.New("object not found in storage")
	ErrComposeUnsupported = errors.New("object sequence cannot be composed by this storage backend")
)

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	UploadStream(ctx context.Context, objectName string, stream io.Reader) error
	CopyObject(ctx context.Context, sourceObjectName, destinationObjectName string) error
	CreateDownloadStream(ctx context.Context, objectName string) (io.ReadCloser, error)
	DeleteFolder(ctx context.Context, folderName string) error
	CountFilesInFolder(ctx context.Context, folderName string) (int, error)
	Clear(ctx context.Context) error
}

func NewAdapter

func NewAdapter(ctx context.Context, cfg config.StorageConfig) (Adapter, error)

type ComposeAdapter added in v1.0.6

type ComposeAdapter interface {
	ComposeObjects(ctx context.Context, destinationObjectName string, sourceObjectNames []string) error
}

type DirectDownloadAdapter

type DirectDownloadAdapter interface {
	CreateDownloadURL(ctx context.Context, objectName string, ttl time.Duration) (string, error)
}

type FilesystemAdapter

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

func NewFilesystemAdapter

func NewFilesystemAdapter(root string) (*FilesystemAdapter, error)

func (*FilesystemAdapter) Clear

func (a *FilesystemAdapter) Clear(_ context.Context) error

func (*FilesystemAdapter) CopyObject added in v1.0.6

func (a *FilesystemAdapter) CopyObject(ctx context.Context, sourceObjectName, destinationObjectName string) error

func (*FilesystemAdapter) CountFilesInFolder

func (a *FilesystemAdapter) CountFilesInFolder(_ context.Context, folderName string) (int, error)

func (*FilesystemAdapter) CreateDownloadStream

func (a *FilesystemAdapter) CreateDownloadStream(_ context.Context, objectName string) (io.ReadCloser, error)

func (*FilesystemAdapter) DeleteFolder

func (a *FilesystemAdapter) DeleteFolder(_ context.Context, folderName string) error

func (*FilesystemAdapter) UploadStream

func (a *FilesystemAdapter) UploadStream(ctx context.Context, objectName string, stream io.Reader) error

type ObjectNotFoundError

type ObjectNotFoundError struct {
	ObjectName string
}

func (ObjectNotFoundError) Error

func (e ObjectNotFoundError) Error() string

func (ObjectNotFoundError) Unwrap

func (e ObjectNotFoundError) Unwrap() error

type S3Adapter

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

func NewS3Adapter

func NewS3Adapter(ctx context.Context, cfg config.StorageConfig) (*S3Adapter, error)

func (*S3Adapter) Clear

func (a *S3Adapter) Clear(ctx context.Context) error

func (*S3Adapter) ComposeObjects added in v1.0.6

func (a *S3Adapter) ComposeObjects(ctx context.Context, destinationObjectName string, sourceObjectNames []string) error

func (*S3Adapter) CopyObject added in v1.0.6

func (a *S3Adapter) CopyObject(ctx context.Context, sourceObjectName, destinationObjectName string) error

func (*S3Adapter) CountFilesInFolder

func (a *S3Adapter) CountFilesInFolder(ctx context.Context, folderName string) (int, error)

func (*S3Adapter) CreateDownloadStream

func (a *S3Adapter) CreateDownloadStream(ctx context.Context, objectName string) (io.ReadCloser, error)

func (*S3Adapter) CreateDownloadURL

func (a *S3Adapter) CreateDownloadURL(ctx context.Context, objectName string, ttl time.Duration) (string, error)

func (*S3Adapter) DeleteFolder

func (a *S3Adapter) DeleteFolder(ctx context.Context, folderName string) error

func (*S3Adapter) UploadStream

func (a *S3Adapter) UploadStream(ctx context.Context, objectName string, stream io.Reader) error

Jump to

Keyboard shortcuts

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