storage

package
v0.0.0-...-2ca1813 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("NoSuchKey: The specified key does not exist.")

Functions

This section is empty.

Types

type DiskStats

type DiskStats struct {
	BytesAll  uint64 `json:"bytes_all"`
	BytesUsed uint64 `json:"bytes_used"`
	BytesFree uint64 `json:"bytes_free"`
}

type LocalStorage

type LocalStorage interface {
	Prefix() string
	Read(key string) (*os.File, error)
	Stat(key string) (os.FileInfo, error)
	Delete(key string) error
	Write(key string, body io.Reader) (int64, error)
	ListFiles(prefix string) ([]os.FileInfo, error)
	CheckAccess(prefix string) error
	DiskStats() (*DiskStats, error)
}

LocalStorage provides access to the local filesystem.

func NewLocalStorage

func NewLocalStorage(prefix string) LocalStorage

type RemoteStorage

type RemoteStorage interface {
	PutObject(key string, r io.ReadSeeker, meta map[string]string) (*Spec, error)
	GetObject(key string, version ...string) (*Spec, error)
	HeadObject(key string, version ...string) (*Spec, error)
	ListObjects(prefix string, startAfter ...string) ([]*Spec, error)
	CheckAccess(prefix string) error
	Bucket() string
}

RemoteStorage provides object access backend, it's usually an AWS S3 client pointed to a specific bucket.

func NewS3Storage

func NewS3Storage(region, bucket string) RemoteStorage

type Spec

type Spec struct {
	Path      string
	Key       string
	Body      io.ReadCloser
	ETag      string
	Version   string
	UpdatedAt time.Time
	Meta      map[string]string
	Size      int64
}

Jump to

Keyboard shortcuts

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