storage

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Region        string
	AccessKey     string
	SecretKey     string
	MinIOEndpoint string
	LocalRootDir  string
	Bucket        string
}

Options for object storage.

type Storage

type Storage interface {
	// Upload uploads a file to an object storage.
	Upload(ctx context.Context, bucket, key string, file io.Reader) error
	// Download downloads a file from a remote object storage location.
	Download(ctx context.Context, bucket, key string, file io.Writer) error
	// MakeBucket creates a new bucket.
	MakeBucket(ctx context.Context, bucket, location string) error
	// Exists checks whether an object exists.
	Exists(ctx context.Context, bucket, key string) (bool, error)
	// List enumerates the list of objects in a bucket.
	List(ctx context.Context, bucket, prefix string) ([]string, error)
	// Delete removes an object from the store.
	Delete(ctx context.Context, bucket, key string) error
}

Storage abstract uploading and download files from different object storage solutions.

func New

func New(kind string, opts Options) (Storage, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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