Documentation ¶
Index ¶
- Constants
- Variables
- func SetupProviders()
- func TranslateProvider(codename string, i *FileProviderInterface)
- type BackblazeAuthPayload
- type BackblazeBucketInfo
- type BackblazeBucketInfoPayload
- type BackblazeFile
- type BackblazeFilePayload
- type BackblazeProvider
- func (bp *BackblazeProvider) CreateDirectory(path string) bool
- func (bp *BackblazeProvider) Delete(path string) bool
- func (bp *BackblazeProvider) GetDirectory(path string) Directory
- func (bp *BackblazeProvider) ObjectInfo(path string) (bool, bool, string)
- func (bp *BackblazeProvider) SaveFile(file io.Reader, filename string, path string) bool
- func (bp *BackblazeProvider) SendFile(path string) (stream io.Reader, contenttype string, err error)
- func (bp *BackblazeProvider) Setup(args map[string]string) bool
- type BackblazeUploadInfo
- type Directory
- type DiskProvider
- func (dp *DiskProvider) CreateDirectory(path string) bool
- func (dp *DiskProvider) Delete(path string) bool
- func (dp *DiskProvider) GetDirectory(path string) Directory
- func (dp *DiskProvider) ObjectInfo(path string) (bool, bool, string)
- func (dp *DiskProvider) SaveFile(file io.Reader, filename string, path string) bool
- func (dp *DiskProvider) SendFile(path string) (stream io.Reader, contenttype string, err error)
- func (dp *DiskProvider) Setup(args map[string]string) bool
- type FileInfo
- type FileProvider
- func (f FileProvider) CreateDirectory(path string) bool
- func (f FileProvider) Delete(path string) bool
- func (f FileProvider) GetDirectory(path string) Directory
- func (f FileProvider) ObjectInfo(path string) (bool, bool, string)
- func (f FileProvider) SaveFile(file io.Reader, filename string, path string) bool
- func (f FileProvider) SendFile(path string) (stream io.Reader, contenttype string, err error)
- func (f FileProvider) Setup(args map[string]string) bool
- type FileProviderInterface
- type S3Provider
- func (s *S3Provider) CreateDirectory(path string) bool
- func (s *S3Provider) Delete(path string) bool
- func (s *S3Provider) GetDirectory(path string) Directory
- func (s *S3Provider) ObjectInfo(path string) (bool, bool, string)
- func (s *S3Provider) SaveFile(file io.Reader, filename string, path string) bool
- func (s *S3Provider) SendFile(path string) (stream io.Reader, contenttype string, err error)
- func (s *S3Provider) Setup(args map[string]string) bool
Constants ¶
const FileIsLocal = "local"
FileIsLocal denotes whether file is a local file.
const FileIsRemote = "remote"
FileIsRemote denotes whether file is a remote file.
Variables ¶
var ProviderConfig map[string]FileProvider
var Providers map[string]*FileProviderInterface
Functions ¶
func SetupProviders ¶
func SetupProviders()
func TranslateProvider ¶
func TranslateProvider(codename string, i *FileProviderInterface)
Types ¶
type BackblazeAuthPayload ¶
type BackblazeBucketInfo ¶
type BackblazeBucketInfoPayload ¶
type BackblazeBucketInfoPayload struct {
Buckets []BackblazeBucketInfo `json:"buckets"`
}
type BackblazeFile ¶
type BackblazeFilePayload ¶
type BackblazeFilePayload struct {
Files []BackblazeFile `json:"files"`
}
type BackblazeProvider ¶
type BackblazeProvider struct { FileProvider Bucket string DownloadLocation string }
func (*BackblazeProvider) CreateDirectory ¶
func (bp *BackblazeProvider) CreateDirectory(path string) bool
func (*BackblazeProvider) Delete ¶
func (bp *BackblazeProvider) Delete(path string) bool
func (*BackblazeProvider) GetDirectory ¶
func (bp *BackblazeProvider) GetDirectory(path string) Directory
func (*BackblazeProvider) ObjectInfo ¶
func (bp *BackblazeProvider) ObjectInfo(path string) (bool, bool, string)
type BackblazeUploadInfo ¶
type DiskProvider ¶
type DiskProvider struct {
FileProvider
}
func (*DiskProvider) CreateDirectory ¶
func (dp *DiskProvider) CreateDirectory(path string) bool
func (*DiskProvider) Delete ¶
func (dp *DiskProvider) Delete(path string) bool
func (*DiskProvider) GetDirectory ¶
func (dp *DiskProvider) GetDirectory(path string) Directory
func (*DiskProvider) ObjectInfo ¶
func (dp *DiskProvider) ObjectInfo(path string) (bool, bool, string)
type FileInfo ¶
FileInfo describes a single file or directory, doing it's best to figure out the extension as well.
type FileProvider ¶
type FileProvider struct { Name string `yaml:"name"` Provider string `yaml:"provider"` Authentication string `yaml:"authentication"` Location string `yaml:"path"` Config map[string]string `yaml:"config"` }
FileProvider aggregates some very basic properties for authentication and provider decoding.
func (FileProvider) CreateDirectory ¶
func (f FileProvider) CreateDirectory(path string) bool
CreateDirectory will create a directory on services that support it.
func (FileProvider) Delete ¶
func (f FileProvider) Delete(path string) bool
Delete simply deletes a file. This is expected to be a destructive action by default.
func (FileProvider) GetDirectory ¶
func (f FileProvider) GetDirectory(path string) Directory
GetDirectory fetches a directory's contents.
func (FileProvider) ObjectInfo ¶
func (f FileProvider) ObjectInfo(path string) (bool, bool, string)
ObjectInfo will return the info for an object given a path to if the file exists and location. Should return whether the path exists, if the path is a directory, and if it lives on disk. (see constants defined: `FILE_IS_REMOTE` and `FILE_IS_LOCAL`)
func (FileProvider) SaveFile ¶
SaveFile will save a file with the contents of the io.Reader at the path specified.
type FileProviderInterface ¶
type FileProviderInterface interface { Setup(args map[string]string) (ok bool) GetDirectory(path string) (directory Directory) SendFile(path string) (stream io.Reader, contenttype string, err error) SaveFile(file io.Reader, filename string, path string) (ok bool) ObjectInfo(path string) (exists bool, isDir bool, location string) CreateDirectory(path string) (ok bool) Delete(path string) (ok bool) }
FileProviderInterface provides some sane default functions.
type S3Provider ¶
type S3Provider struct { FileProvider Region string Bucket string Endpoint string KeyID string KeySecret string // contains filtered or unexported fields }
func (*S3Provider) CreateDirectory ¶
func (s *S3Provider) CreateDirectory(path string) bool
CreateDirectory will create a directory on services that support it.
func (*S3Provider) Delete ¶
func (s *S3Provider) Delete(path string) bool
Delete simply deletes a file. This is expected to be a destructive action by default.
func (*S3Provider) GetDirectory ¶
func (s *S3Provider) GetDirectory(path string) Directory
GetDirectory fetches a directory's contents.
func (*S3Provider) ObjectInfo ¶
func (s *S3Provider) ObjectInfo(path string) (bool, bool, string)