storage

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmazonS3Backend

type AmazonS3Backend struct {
	Bucket     string
	Client     *s3.S3
	Downloader *s3manager.Downloader
	Prefix     string
	Uploader   *s3manager.Uploader
}

AmazonS3Backend is a storage backend for Amazon S3

func NewAmazonS3Backend

func NewAmazonS3Backend(bucket string, prefix string, region string, endpoint string) *AmazonS3Backend

NewAmazonS3Backend creates a new instance of AmazonS3Backend

func (AmazonS3Backend) DeleteObject

func (b AmazonS3Backend) DeleteObject(path string) error

DeleteObject removes an object from Amazon S3 bucket, at prefix

func (AmazonS3Backend) GetObject

func (b AmazonS3Backend) GetObject(path string) (Object, error)

GetObject retrieves an object from Amazon S3 bucket, at prefix

func (AmazonS3Backend) ListObjects

func (b AmazonS3Backend) ListObjects() ([]Object, error)

ListObjects lists all objects in Amazon S3 bucket, at prefix

func (AmazonS3Backend) PutObject

func (b AmazonS3Backend) PutObject(path string, content []byte) error

PutObject uploads an object to Amazon S3 bucket, at prefix

type Backend

type Backend interface {
	ListObjects() ([]Object, error)
	GetObject(path string) (Object, error)
	PutObject(path string, content []byte) error
	DeleteObject(path string) error
}

Backend is a generic interface for storage backends

type GoogleCSBackend

type GoogleCSBackend struct {
	Prefix  string
	Query   *storage.Query
	Client  *storage.BucketHandle
	Context context.Context
}

GoogleCSBackend is a storage backend for Google Cloud Storage

func NewGoogleCSBackend

func NewGoogleCSBackend(bucket string, prefix string) *GoogleCSBackend

NewGoogleCSBackend creates a new instance of GoogleCSBackend

func (GoogleCSBackend) DeleteObject

func (b GoogleCSBackend) DeleteObject(path string) error

DeleteObject removes an object from Google Cloud Storage bucket, at prefix

func (GoogleCSBackend) GetObject

func (b GoogleCSBackend) GetObject(path string) (Object, error)

GetObject retrieves an object from Google Cloud Storage bucket, at prefix

func (GoogleCSBackend) ListObjects

func (b GoogleCSBackend) ListObjects() ([]Object, error)

ListObjects lists all objects in Google Cloud Storage bucket, at prefix

func (GoogleCSBackend) PutObject

func (b GoogleCSBackend) PutObject(path string, content []byte) error

PutObject uploads an object to Google Cloud Storage bucket, at prefix

type LocalFilesystemBackend

type LocalFilesystemBackend struct {
	RootDirectory string
}

LocalFilesystemBackend is a storage backend for local filesystem storage

func NewLocalFilesystemBackend

func NewLocalFilesystemBackend(rootDirectory string) *LocalFilesystemBackend

NewLocalFilesystemBackend creates a new instance of LocalFilesystemBackend

func (LocalFilesystemBackend) DeleteObject

func (b LocalFilesystemBackend) DeleteObject(path string) error

DeleteObject removes an object from root directory

func (LocalFilesystemBackend) GetObject

func (b LocalFilesystemBackend) GetObject(path string) (Object, error)

GetObject retrieves an object from root directory

func (LocalFilesystemBackend) ListObjects

func (b LocalFilesystemBackend) ListObjects() ([]Object, error)

ListObjects lists all objects in root directory (depth 1)

func (LocalFilesystemBackend) PutObject

func (b LocalFilesystemBackend) PutObject(path string, content []byte) error

PutObject puts an object in root directory

type Object

type Object struct {
	Path         string
	Content      []byte
	LastModified time.Time
}

Object is a generic representation of a storage object

func (Object) HasExtension

func (object Object) HasExtension(extension string) bool

HasExtension determines whether or not an object contains a file extension

type ObjectSliceDiff

type ObjectSliceDiff struct {
	Change  bool
	Removed []Object
	Added   []Object
	Updated []Object
}

ObjectSliceDiff provides information on what has changed since last calling ListObjects

func GetObjectSliceDiff

func GetObjectSliceDiff(os1 []Object, os2 []Object) ObjectSliceDiff

GetObjectSliceDiff takes two objects slices and returns an ObjectSliceDiff

Jump to

Keyboard shortcuts

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