storage

package
v0.0.0-...-b52fdba Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGoogleDriveClientID     = "304359942533-ra5badnhb5f1umi5vj4p5oohfhdiq8v8.apps.googleusercontent.com"
	DefaultGoogleDriveClientSecret = "2ORaxB_WysnMlfeYW5yZsBgH"
	GoogleDrive                    = GoogleDriveProvider(1)
)

Variables

View Source
var (
	Mega = &MegaProvider{
		clients: make(chan megaClient, 10),
	}
	MegaFileNotFound = fmt.Errorf("mega.co.nz file not found")
)
View Source
var BitBucket = bitbucket{/* contains filtered or unexported fields */}

BitBucket stores data on BitBucket

View Source
var CopyCloudStorage = &CopyCloudStorageProvider{}
View Source
var Git gitStorage

Git retrieves a file via `git archive`

View Source
var GitHub githubStorage

GitHub stores data on GitHub

View Source
var HTTP httpStorage

HTTP stores data over http

View Source
var S3 = &S3Provider{}

Functions

func Authenticate

func Authenticate(typ string)

func Delete

func Delete(loc Location) error

func Get

func Get(loc Location) (io.ReadCloser, error)

Get returns an io.ReadCloser for the given location

func List

func List(loc Location) ([]string, error)

List returns a list of filenames for the given location

func Put

func Put(loc Location, rdr io.Reader) error

Put writes an io.Reader to the given location

func Register

func Register(scheme string, provider interface{})

Register registers a provider

func RegisterAuth

func RegisterAuth(scheme string, authProvider AuthProvider)

func Version

func Version(loc Location, previous string) (string, error)

Version returns the version of the file at the given location

Types

type AuthProvider

type AuthProvider interface {
	Authenticate()
}

type AzureProvider

type AzureProvider byte

func (AzureProvider) Get

func (az AzureProvider) Get(rawurl string) (io.ReadCloser, error)

func (AzureProvider) List

func (az AzureProvider) List(rawurl string) ([]string, error)

func (AzureProvider) Put

func (az AzureProvider) Put(rawurl string, rdr io.Reader) error

type CopyCloudStorageProvider

type CopyCloudStorageProvider struct{}

func (*CopyCloudStorageProvider) Delete

func (ccsp *CopyCloudStorageProvider) Delete(loc Location) error

func (*CopyCloudStorageProvider) Get

func (*CopyCloudStorageProvider) List

func (ccsp *CopyCloudStorageProvider) List(loc Location) ([]string, error)

func (*CopyCloudStorageProvider) Put

func (ccsp *CopyCloudStorageProvider) Put(loc Location, rdr io.Reader) error

func (*CopyCloudStorageProvider) Version

func (ccsp *CopyCloudStorageProvider) Version(loc Location, previous string) (string, error)

type DeleteOnClose

type DeleteOnClose struct {
	*os.File
}

func (DeleteOnClose) Close

func (doc DeleteOnClose) Close() error

type DropBoxProvider

type DropBoxProvider byte

func (DropBoxProvider) Get

func (dbp DropBoxProvider) Get(rawurl string) (io.ReadCloser, error)

func (DropBoxProvider) List

func (dbp DropBoxProvider) List(rawurl string) ([]string, error)

func (DropBoxProvider) Put

func (dbp DropBoxProvider) Put(rawurl string, rdr io.Reader) error

type FTPProvider

type FTPProvider byte

func (FTPProvider) Get

func (fp FTPProvider) Get(rawurl string) (io.ReadCloser, error)

func (FTPProvider) List

func (fp FTPProvider) List(rawurl string) ([]string, error)

func (FTPProvider) Put

func (fp FTPProvider) Put(rawurl string, rdr io.Reader) error

type FishProvider

type FishProvider byte

func (FishProvider) Get

func (fp FishProvider) Get(rawurl string) (io.ReadCloser, error)

func (FishProvider) List

func (fp FishProvider) List(rawurl string) ([]string, error)

func (FishProvider) Put

func (fp FishProvider) Put(rawurl string, rdr io.Reader) error

type Getter

type Getter interface {
	Get(location Location) (io.ReadCloser, error)
}

A Getter can get files

type GoogleDriveProvider

type GoogleDriveProvider byte

func (GoogleDriveProvider) Authenticate

func (gdp GoogleDriveProvider) Authenticate()

func (GoogleDriveProvider) Delete

func (gdp GoogleDriveProvider) Delete(loc Location) error

func (GoogleDriveProvider) Get

func (GoogleDriveProvider) List

func (gdp GoogleDriveProvider) List(loc Location) ([]string, error)

func (GoogleDriveProvider) Put

func (gdp GoogleDriveProvider) Put(loc Location, rdr io.Reader) error

func (GoogleDriveProvider) Version

func (gdp GoogleDriveProvider) Version(loc Location, previous string) (string, error)

type Lister

type Lister interface {
	List(Location) ([]string, error)
}

A Lister can list files

type LocalProvider

type LocalProvider byte
var Local LocalProvider

func (LocalProvider) Delete

func (lp LocalProvider) Delete(location Location) error

func (LocalProvider) Get

func (lp LocalProvider) Get(location Location) (io.ReadCloser, error)

func (LocalProvider) List

func (lp LocalProvider) List(loc Location) ([]string, error)

func (LocalProvider) Put

func (lp LocalProvider) Put(location Location, rdr io.Reader) error

func (LocalProvider) Version

func (lp LocalProvider) Version(loc Location, previous string) (string, error)

type Location

type Location map[string]string

func ParseLocation

func ParseLocation(obj interface{}) (Location, error)

ParseLocation parses a location from a variety of input formats

func (Location) Ext

func (loc Location) Ext() string

func (Location) Host

func (loc Location) Host() string

func (Location) Path

func (loc Location) Path() string

func (Location) Query

func (loc Location) Query() url.Values

Query returns query string parameters from the original location

func (Location) Type

func (loc Location) Type() string

func (*Location) UnmarshalYAML

func (loc *Location) UnmarshalYAML(unmarshal func(interface{}) error) error

type MegaProvider

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

func (*MegaProvider) Delete

func (mp *MegaProvider) Delete(loc Location) error

func (*MegaProvider) Get

func (mp *MegaProvider) Get(loc Location) (io.ReadCloser, error)

func (*MegaProvider) List

func (mp *MegaProvider) List(loc Location) ([]string, error)

func (*MegaProvider) Put

func (mp *MegaProvider) Put(loc Location, rdr io.Reader) error

func (*MegaProvider) Version

func (mp *MegaProvider) Version(loc Location, previous string) (string, error)

type Provider

type Provider interface {
	Getter
	Putter
	Lister
	Versioner

	Delete(location Location) error
}

func GetProvider

func GetProvider(loc Location) (Provider, error)

type Putter

type Putter interface {
	Put(location Location, rdr io.Reader) error
}

A Putter can put files

type RackSpaceProvider

type RackSpaceProvider byte

func (RackSpaceProvider) Get

func (rsp RackSpaceProvider) Get(rawurl string) (io.ReadCloser, error)

func (RackSpaceProvider) List

func (rsp RackSpaceProvider) List(rawurl string) ([]string, error)

func (RackSpaceProvider) Put

func (rsp RackSpaceProvider) Put(rawurl string, rdr io.Reader) error

type S3Provider

type S3Provider struct {
}

func (*S3Provider) Delete

func (s3p *S3Provider) Delete(rawurl string) error

func (*S3Provider) Get

func (s3p *S3Provider) Get(rawurl string) (io.ReadCloser, error)

func (*S3Provider) List

func (s3p *S3Provider) List(rawurl string) ([]string, error)

func (*S3Provider) Put

func (s3p *S3Provider) Put(rawurl string, rdr io.Reader) error

func (*S3Provider) Version

func (s3p *S3Provider) Version(rawurl, previous string) (string, error)

type Sizer

type Sizer interface {
	Size() (int64, error)
}

type Versioner

type Versioner interface {
	Version(location Location, previous string) (string, error)
}

Jump to

Keyboard shortcuts

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