Documentation
¶
Index ¶
Constants ¶
View Source
const ( // S3DefaultPartSize is the default part size for S3 multipart uploads (10 MB). S3DefaultPartSize int64 = 10 * 1024 * 1024 // S3MinPartSize is the minimum part size for S3 multipart uploads (5 MB). S3MinPartSize int64 = 5 * 1024 * 1024 // S3MaxPartSize is the maximum part size for S3 multipart uploads (5 GiB). S3MaxPartSize int64 = 5 * 1024 * 1024 * 1024 )
Variables ¶
View Source
var ( ErrInvalidArgument = errors.New("invalid argument") ErrNotFound = errors.New("object not found") ErrLockFailed = errors.New("lock failed") )
View Source
var (
ErrFTPHostRequired = errors.New("FTP storage requires host")
)
View Source
var (
ErrUnsupportedStorageType = errors.New("unsupported storage type")
)
Functions ¶
This section is empty.
Types ¶
type Backend ¶ added in v0.5.1
type Backend interface {
// Upload uploads data to the specified path in the storage backend
Upload(ctx context.Context, filename string, data io.Reader) error
// Download downloads data from the specified path in the storage backend
Download(ctx context.Context, filename string, data io.Writer) error
// Delete removes a single object from the storage backend.
Delete(ctx context.Context, filename string) error
// List returns filenames available in the current backend prefix/path.
List(ctx context.Context) ([]string, error)
// UploadBytes uploads a small in-memory object to the backend.
UploadBytes(ctx context.Context, filename string, data []byte) error
// DownloadBytes downloads a small object from the backend into memory.
DownloadBytes(ctx context.Context, filename string) ([]byte, error)
// Lock locks a file in the storage backend, preventing concurrent writes.
Lock(ctx context.Context, filename string) (Locker, error)
// Close closes the storage backend and releases any resources.
// Implementations that don't require cleanup should return nil.
Close() error
}
Backend defines the interface for pluggable storage backends.
Click to show internal directories.
Click to hide internal directories.