storage

package
v0.0.0-...-3a47d3a Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStorageNotFound = fmt.Errorf("storage not found")
	ErrEntryExists     = fmt.Errorf("entry already exists")
	ErrEntryNotFound   = fmt.Errorf("entry not found")
)

Functions

This section is empty.

Types

type Base

type Base struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Cache bool   `json:"cache"`
}

type Local

type Local struct {
	Base
	BasePath string `json:"basePath"`
}

func NewLocal

func NewLocal(id, basePath string) Local

func (Local) EntryExists

func (l Local) EntryExists(path string) (bool, error)

func (Local) GetID

func (l Local) GetID() string

func (Local) GetType

func (l Local) GetType() string

func (Local) ReadEntry

func (l Local) ReadEntry(path string, writer io.Writer) error

func (Local) ShouldCache

func (l Local) ShouldCache() bool

func (Local) WriteEntry

func (l Local) WriteEntry(path string, reader io.Reader) error

type S3

type S3 struct {
	Base
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
	Bucket    string `json:"bucket"`
	Region    string `json:"region"`
	BasePath  string `json:"basePath"`
	// contains filtered or unexported fields
}

func NewS3

func NewS3(id, basePath, awsKey, awsSecret, bucket, region string) (S3, error)

func (S3) EntryExists

func (s S3) EntryExists(path string) (bool, error)

func (S3) GetID

func (s S3) GetID() string

func (S3) GetType

func (s S3) GetType() string

func (S3) ReadEntry

func (s S3) ReadEntry(path string, writer io.Writer) error

func (S3) ShouldCache

func (s S3) ShouldCache() bool

func (*S3) UnmarshalJSON

func (s *S3) UnmarshalJSON(data []byte) error

func (S3) WriteEntry

func (s S3) WriteEntry(path string, reader io.Reader) error

type Storage

type Storage interface {
	GetID() string
	GetType() string
	ShouldCache() bool
	EntryExists(path string) (bool, error)
	WriteEntry(path string, reader io.Reader) error
	ReadEntry(path string, writer io.Writer) error
}

func FindStorage

func FindStorage(storages []Storage, id string) Storage

Jump to

Keyboard shortcuts

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