storage

package
v0.0.0-...-830b495 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: BSD-3-Clause, MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlibabaCloudOSSBackend

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

AlibabaCloudOSSBackend is a storage backend for Alibaba Cloud OSS

func NewAlibabaCloudOSSBackend

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

NewAlibabaCloudOSSBackend creates a new instance of AlibabaCloudOSSBackend

func (AlibabaCloudOSSBackend) DeleteObject

func (b AlibabaCloudOSSBackend) DeleteObject(path string) error

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

func (AlibabaCloudOSSBackend) GetObject

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

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

func (AlibabaCloudOSSBackend) ListObjects

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

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

func (AlibabaCloudOSSBackend) PutObject

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(prefix string) ([]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(prefix string) ([]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
	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(prefix string) ([]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(prefix string) ([]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

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

MicrosoftBlobBackend is a storage backend for Microsoft Azure Blob Storage

func NewMicrosoftBlobBackend

func NewMicrosoftBlobBackend(container string, prefix string) *MicrosoftBlobBackend

NewMicrosoftBlobBackend creates a new instance of MicrosoftBlobBackend

func (MicrosoftBlobBackend) DeleteObject

func (b MicrosoftBlobBackend) DeleteObject(path string) error

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

func (MicrosoftBlobBackend) GetObject

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

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

func (MicrosoftBlobBackend) ListObjects

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

ListObjects lists all objects in Microsoft Azure Blob Storage container

func (MicrosoftBlobBackend) PutObject

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

type OpenstackOSBackend

type OpenstackOSBackend struct {
	Container string
	Prefix    string
	Region    string
	CACert    string
	Client    *gophercloud.ServiceClient
}

OpenstackOSBackend is a storage backend for Openstack Object Storage

func NewOpenstackOSBackend

func NewOpenstackOSBackend(container string, prefix string, region string, caCert string) *OpenstackOSBackend

NewOpenstackOSBackend creates a new instance of OpenstackOSBackend

func (OpenstackOSBackend) DeleteObject

func (b OpenstackOSBackend) DeleteObject(path string) error

DeleteObject removes an object from an Openstack container, at prefix

func (OpenstackOSBackend) GetObject

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

GetObject retrieves an object from an Openstack container, at prefix

func (OpenstackOSBackend) ListObjects

func (b OpenstackOSBackend) ListObjects(prefix string) ([]Object, error)

ListObjects lists all objects in an Openstack container, at prefix

func (OpenstackOSBackend) PutObject

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

PutObject uploads an object to Openstack container, at prefix

type ReauthRoundTripper

type ReauthRoundTripper struct {
	// contains filtered or unexported fields
}

ReauthRoundTripper satisfies the http.RoundTripper interface and is used to limit the number of re-auth attempts (infinite by default)

func (*ReauthRoundTripper) RoundTrip

func (rrt *ReauthRoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip performs a round-trip HTTP request and logs relevant information about it.

Jump to

Keyboard shortcuts

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