storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSystem

type FileSystem struct {
	Env  string
	Root string
}

func NewFileSystem

func NewFileSystem(env string) *FileSystem

NewFileSystem is constructor for FileSystem

func (*FileSystem) Create

func (fs *FileSystem) Create(fullpath string, data []byte) error

Create saves JSON data with fullpath as key.

func (*FileSystem) CreateOrUpdate

func (fs *FileSystem) CreateOrUpdate(fullpath string, data []byte) error

func (*FileSystem) Delete

func (fs *FileSystem) Delete(fullpath string) error

Delete removes item with fullpath as key.

func (*FileSystem) Get

func (fs *FileSystem) Get(fullpath string) ([]byte, error)

Get returns JSON data with fullpath as key.

func (*FileSystem) GetRoot

func (fs *FileSystem) GetRoot() string

GetRoot returns root path.

func (*FileSystem) List

func (fs *FileSystem) List(fullpath string) ([]string, error)

List returns a slice of base paths.

func (*FileSystem) Update

func (fs *FileSystem) Update(fullpath string, data []byte) error

Update saves JSON data with fullpath as key.

type S3

type S3 struct {
	Env        string
	AccessKey  string
	SecretKey  string
	RegionName string
	BucketName string
	Root       string
	Region     goamz_aws.Region
	Connection *goamz_s3.S3
	Bucket     *goamz_s3.Bucket
}

func NewS3

func NewS3(env, accessKey, secretKey, regionName, bucketName string) *S3

NewS3 is constructor for S3

func (*S3) Create

func (store *S3) Create(fullpath string, data []byte) error

Create saves JSON data with fullpath as key.

func (*S3) Delete

func (store *S3) Delete(fullpath string) error

Delete removes item with fullpath as key.

func (*S3) Get

func (store *S3) Get(fullpath string) ([]byte, error)

Get returns JSON data with fullpath as key.

func (*S3) GetRoot

func (store *S3) GetRoot() string

GetRoot returns root path.

func (*S3) List

func (store *S3) List(fullpath string) ([]string, error)

List returns a slice of full reminder paths.

func (*S3) Update

func (store *S3) Update(fullpath string, data []byte) error

Update saves JSON data with fullpath as key.

type Storer

type Storer interface {
	GetRoot() string
	Create(string, []byte) error
	Update(string, []byte) error
	Get(string) ([]byte, error)
	List(string) ([]string, error)
	Delete(string) error
}

func NewStorage

func NewStorage() Storer

Jump to

Keyboard shortcuts

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