storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 25 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound          = errors.New("file not found")
	ErrInvalidStorageKey = errors.New("invalid storage key")
)

Functions

func TeeReader

func TeeReader(r io.Reader, w io.Writer) io.Reader

Types

type Stat

type Stat interface {
	Size() int64
	ModTime() time.Time
}

type Storage

type Storage interface {
	Stat(key string) (stat Stat, err error)
	Get(key string) (content io.ReadCloser, stat Stat, err error)
	Put(key string, r io.Reader) error
	Delete(key string) error
	List(prefix string) (keys []string, err error)
	DeleteAll(prefix string) (deletedKeys []string, err error)
}

func New

func New(options *StorageOptions) (storage Storage, err error)

func NewFSStorage

func NewFSStorage(root string) (storage Storage, err error)

NewFSStorage creates a new storage instance that stores files on the local filesystem.

func NewS3Storage

func NewS3Storage(options *StorageOptions) (Storage, error)

NewS3Storage creates a new S3-compatible storage.

type StorageOptions

type StorageOptions struct {
	Type            string `json:"type"`
	Endpoint        string `json:"endpoint"`
	Region          string `json:"region"`
	AccessKeyID     string `json:"accessKeyID"`
	SecretAccessKey string `json:"secretAccessKey"`
	CacheDir        string `json:"cacheDir"`
}

Jump to

Keyboard shortcuts

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