storage

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MultipartCopyThresholdSize ...
	MultipartCopyThresholdSize = 32 << 20 // 32MB
	// MultipartCopyChunkSize ...
	MultipartCopyChunkSize = 32 << 20 // 32MB
	// MultipartCopyMaxConcurrency ...
	MultipartCopyMaxConcurrency = 100 // 100 goroutines
	// MaxPaginationKeys ...
	MaxPaginationKeys = 1000 // 1000 keys
)

Variables

This section is empty.

Functions

func Initialize

func Initialize(config configs.Configuration) error

Initialize initializes the storage driver

func RegisterDriverFactory

func RegisterDriverFactory(name string, factory Factory) error

RegisterDriverFactory registers a storage factory driver by name. If RegisterDriverFactory is called twice with the same name or if driver is nil, it panics.

func SanitizePath

func SanitizePath(rootDirectory, p string) string

SanitizePath ...

Types

type Factory

type Factory interface {
	New(config configs.Configuration) (StorageDriver, error)
}

Factory is the interface for the storage driver factory

type StorageDriver

type StorageDriver interface {
	// Move moves an object stored at sourcePath to destPath, removing the
	// original object.
	// Note: This may be no more efficient than a copy followed by a delete for
	// many implementations.
	Move(ctx context.Context, sourcePath string, destPath string) error

	// Delete recursively deletes all objects stored at "path" and its subpaths.
	Delete(ctx context.Context, path string) error

	// Reader retrieves an io.ReadCloser for the content stored at "path"
	// with a given byte offset.
	Reader(ctx context.Context, path string) (io.ReadCloser, error)

	// CreateUploadID creates a new multipart upload and returns an
	// opaque upload ID.
	CreateUploadID(ctx context.Context, path string) (string, error)

	// WritePart writes a part of a multipart upload.
	UploadPart(ctx context.Context, path, uploadID string, partNumber int64, body io.Reader) (string, error)

	// CommitUpload commits a multipart upload.
	CommitUpload(ctx context.Context, path string, uploadID string, parts []string) error

	// AbortUpload aborts a multipart upload.
	AbortUpload(ctx context.Context, path string, uploadID string) error

	// Upload upload a file to the given path.
	Upload(ctx context.Context, path string, body io.Reader) error

	// Redirect get a temporary link
	Redirect(ctx context.Context, path string) (string, error)
}

StorageDriver is the interface for the storage driver

var Driver StorageDriver

Driver is the storage driver

type StorageDriverFactory

type StorageDriverFactory interface {
	// New new storage driver
	New() StorageDriver
}

StorageDriverFactory ...

func NewStorageDriverFactory

func NewStorageDriverFactory() StorageDriverFactory

NewStorageDriverFactory ...

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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