storage

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlibabaCloudOSSBackend added in v0.4.0

type AlibabaCloudOSSBackend struct {
	Bucket *oss.Bucket
	Client *oss.Client
	Prefix string
	SSE    string
}

AlibabaCloudOSSBackend is a storage backend for Alibaba Cloud OSS

func NewAlibabaCloudOSSBackend added in v0.4.0

func NewAlibabaCloudOSSBackend(bucket string, prefix string, endpoint string, sse string) *AlibabaCloudOSSBackend

NewAlibabaCloudOSSBackend creates a new instance of AlibabaCloudOSSBackend

func (AlibabaCloudOSSBackend) DeleteObject added in v0.4.0

func (b AlibabaCloudOSSBackend) DeleteObject(path string) error

DeleteObject removes an object from Alibaba Cloud OSS bucket, at prefix

func (AlibabaCloudOSSBackend) GetObject added in v0.4.0

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

GetObject retrieves an object from Alibaba Cloud OSS bucket, at prefix

func (AlibabaCloudOSSBackend) ListObjects added in v0.4.0

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

ListObjects lists all objects in Alibaba Cloud OSS bucket, at prefix

func (AlibabaCloudOSSBackend) PutObject added in v0.4.0

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

PutObject uploads an object to Alibaba Cloud OSS bucket, at prefix

type AmazonS3Backend

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

AmazonS3Backend is a storage backend for Amazon S3

func NewAmazonS3Backend

func NewAmazonS3Backend(bucket string, prefix string, region string, endpoint string, sse 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 MicrosoftBlobBackend added in v0.3.0

type MicrosoftBlobBackend struct {
	Prefix    string
	Container *microsoft_storage.Container
}

MicrosoftBlobBackend is a storage backend for Microsoft Azure Blob Storage

func NewMicrosoftBlobBackend added in v0.3.0

func NewMicrosoftBlobBackend(container string, prefix string) *MicrosoftBlobBackend

NewMicrosoftBlobBackend creates a new instance of MicrosoftBlobBackend

func (MicrosoftBlobBackend) DeleteObject added in v0.3.0

func (b MicrosoftBlobBackend) DeleteObject(path string) error

DeleteObject removes an object from Microsoft Azure Blob Storage container, at path

func (MicrosoftBlobBackend) GetObject added in v0.3.0

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

GetObject retrieves an object from Microsoft Azure Blob Storage, at path

func (MicrosoftBlobBackend) ListObjects added in v0.3.0

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

ListObjects lists all objects in Microsoft Azure Blob Storage container

func (MicrosoftBlobBackend) PutObject added in v0.3.0

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

PutObject uploads an object to Microsoft Azure Blob Storage container, at path

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