storage

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 21 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")
)
View Source
var ErrIndexedObjectMissing = errors.New("indexed storage object is missing")

Functions

func MergedObject added in v1.1.1

func MergedObject(folderName string) string

func PartsFolder added in v1.1.1

func PartsFolder(folderName string) string

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)
	InspectObject(ctx context.Context, objectName string) (ObjectMetadata, error)
	InspectFolder(ctx context.Context, folderName string) (FolderContents, error)
	Inventory(ctx context.Context) (Inventory, error)
	ObjectExists(ctx context.Context, objectName string) (bool, 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) CleanupTemporaryUploads added in v1.1.1

func (a *FilesystemAdapter) CleanupTemporaryUploads(ctx context.Context, candidates []ObjectMetadata, cutoff time.Time) (int, 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) FilesystemUsage added in v1.1.1

func (a *FilesystemAdapter) FilesystemUsage(ctx context.Context) (FilesystemUsage, error)

func (*FilesystemAdapter) InspectFolder added in v1.1.1

func (a *FilesystemAdapter) InspectFolder(ctx context.Context, folderName string) (FolderContents, error)

func (*FilesystemAdapter) InspectObject added in v1.1.1

func (a *FilesystemAdapter) InspectObject(ctx context.Context, objectName string) (ObjectMetadata, error)

func (*FilesystemAdapter) Inventory added in v1.1.1

func (a *FilesystemAdapter) Inventory(ctx context.Context) (Inventory, error)

func (*FilesystemAdapter) ObjectExists added in v1.1.1

func (a *FilesystemAdapter) ObjectExists(ctx context.Context, objectName string) (bool, error)

func (*FilesystemAdapter) UploadStream

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

type FilesystemUsage added in v1.1.1

type FilesystemUsage struct {
	CapacityBytes int64
	UsedBytes     int64
}

type FilesystemUsageAdapter added in v1.1.1

type FilesystemUsageAdapter interface {
	FilesystemUsage(ctx context.Context) (FilesystemUsage, error)
}

type FolderContents added in v1.1.1

type FolderContents struct {
	FolderName       string
	Exists           bool
	Objects          []ObjectMetadata
	ObjectCount      int64
	PhysicalBytes    int64
	NewestModifiedAt time.Time
}

func (FolderContents) LogicalIndexedSize added in v1.1.1

func (f FolderContents) LogicalIndexedSize(partCount int) (int64, error)

type FolderInventory added in v1.1.1

type FolderInventory struct {
	FolderName       string
	Parts            []PartObject
	Blocks           ObjectSummary
	Merged           *ObjectMetadata
	Unknown          ObjectSummary
	ObjectCount      int64
	PhysicalBytes    int64
	NewestModifiedAt time.Time
}

func (FolderInventory) LogicalPartsSize added in v1.1.1

func (f FolderInventory) LogicalPartsSize(partCount int) (int64, error)

type IndexedObjectMissingError added in v1.1.1

type IndexedObjectMissingError struct {
	Index int
}

func (IndexedObjectMissingError) Error added in v1.1.1

func (IndexedObjectMissingError) Unwrap added in v1.1.1

func (e IndexedObjectMissingError) Unwrap() error

type Inventory added in v1.1.1

type Inventory struct {
	Folders          []FolderInventory
	LooseObjects     []ObjectMetadata
	TemporaryUploads []ObjectMetadata
	ObjectCount      int64
	PhysicalBytes    int64
	NewestModifiedAt time.Time
}

func (Inventory) Folder added in v1.1.1

func (i Inventory) Folder(folderName string) (FolderInventory, bool)

type ObjectMetadata added in v1.1.1

type ObjectMetadata struct {
	Name       string
	SizeBytes  int64
	ModifiedAt time.Time
}

type ObjectNotFoundError

type ObjectNotFoundError struct {
	ObjectName string
}

func (ObjectNotFoundError) Error

func (e ObjectNotFoundError) Error() string

func (ObjectNotFoundError) Unwrap

func (e ObjectNotFoundError) Unwrap() error

type ObjectSummary added in v1.1.1

type ObjectSummary struct {
	ObjectCount      int64
	PhysicalBytes    int64
	NewestModifiedAt time.Time
}

type PartObject added in v1.1.1

type PartObject struct {
	Index      int
	SizeBytes  int64
	ModifiedAt time.Time
}

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) InspectFolder added in v1.1.1

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

func (*S3Adapter) InspectObject added in v1.1.1

func (a *S3Adapter) InspectObject(ctx context.Context, objectName string) (ObjectMetadata, error)

func (*S3Adapter) Inventory added in v1.1.1

func (a *S3Adapter) Inventory(ctx context.Context) (Inventory, error)

func (*S3Adapter) ObjectExists added in v1.1.1

func (a *S3Adapter) ObjectExists(ctx context.Context, objectName string) (bool, error)

func (*S3Adapter) UploadStream

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

type TemporaryUploadCleaner added in v1.1.1

type TemporaryUploadCleaner interface {
	CleanupTemporaryUploads(ctx context.Context, candidates []ObjectMetadata, cutoff time.Time) (int, error)
}

Jump to

Keyboard shortcuts

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