storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 19 Imported by: 0

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