storage

package
v0.0.0-...-1659c99 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend string
const (
	S3Backend    Backend = "s3"
	LocalBackend Backend = "local"
)

type LocalStorage

type LocalStorage struct {
	// contains filtered or unexported fields
}

func NewLocalStorage

func NewLocalStorage(dir, prefix string) (*LocalStorage, error)

func (LocalStorage) Backend

func (s LocalStorage) Backend() string

func (*LocalStorage) Delete

func (s *LocalStorage) Delete(fpath string) error

func (*LocalStorage) ServeHTTP

func (s *LocalStorage) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*LocalStorage) Upload

func (s *LocalStorage) Upload(r io.Reader, fpath string) (string, error)

type S3Storage

type S3Storage struct {
	// contains filtered or unexported fields
}

func NewS3Storage

func NewS3Storage(bucket, prefix, urlstr string) (*S3Storage, error)

func (S3Storage) Backend

func (s S3Storage) Backend() string

func (*S3Storage) Delete

func (s *S3Storage) Delete(fpath string) error

func (*S3Storage) ServeHTTP

func (s *S3Storage) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*S3Storage) Upload

func (s *S3Storage) Upload(r io.Reader, fpath string) (string, error)

type Storage

type Storage interface {
	Upload(r io.Reader, fpath string) (string, error)
	Delete(fpath string) error
	ServeHTTP(w http.ResponseWriter, r *http.Request)
	Backend() string
}

Jump to

Keyboard shortcuts

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