Documentation
¶
Index ¶
- Variables
- func InitialiseDriverMap()
- type Driver
- type LocalDriver
- func (d *LocalDriver) Connect() error
- func (d *LocalDriver) DeleteFile(path string) error
- func (d *LocalDriver) Disconnect() error
- func (d *LocalDriver) DownloadFile(path string, targetPath string) error
- func (d *LocalDriver) GetFile(path string) ([]byte, error)
- func (d *LocalDriver) ListFiles(path string) ([]string, error)
- func (d *LocalDriver) Started() bool
- func (d *LocalDriver) StreamFile(path string) (io.ReadCloser, error)
- func (d *LocalDriver) UploadFile(file LocalFile) (RemoteFile, error)
- type LocalFile
- type RemoteFile
- type SftpDriver
- func (d *SftpDriver) Connect() error
- func (d *SftpDriver) DeleteFile(path string) error
- func (d *SftpDriver) Disconnect() error
- func (d *SftpDriver) DownloadFile(path string, targetPath string) error
- func (d *SftpDriver) GetFile(path string) ([]byte, error)
- func (d *SftpDriver) ListFiles(path string) ([]string, error)
- func (d *SftpDriver) Started() bool
- func (d *SftpDriver) StreamFile(path string) (io.ReadCloser, error)
- func (d *SftpDriver) UploadFile(file LocalFile) (RemoteFile, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DriverTypes Used for the CLI interface, to list all available driver types DriverTypes = []string{"local", "sftp"} // DriverFields Used for the CLI interface, to list all required fields for each driver type DriverFields = map[string][]string{ "local": {"Name", "MaxSize", "RootPath"}, "sftp": {"Name", "MaxSize", "RootPath", "Ip", "Port", "Username", "Password"}, } DriverMap = map[string]Driver{} )
Functions ¶
func InitialiseDriverMap ¶
func InitialiseDriverMap()
Types ¶
type Driver ¶
type Driver interface {
Started() bool
Connect() error
Disconnect() error
UploadFile(file LocalFile) (RemoteFile, error)
StreamFile(path string) (io.ReadCloser, error)
DownloadFile(path string, targetPath string) error
DeleteFile(path string) error
ListFiles(path string) ([]string, error)
GetFile(path string) ([]byte, error)
}
func GetDriverFromBucket ¶
func GetDriverFromBucket(bucket database.StorageBucket) Driver
func GetInitialisedDriver ¶
func GetInitialisedDriver(bucket database.StorageBucket) Driver
func NewLocalDriver ¶
func NewSFTPDRiver ¶
type LocalDriver ¶
type LocalDriver struct {
RootPath string
}
func (*LocalDriver) Connect ¶
func (d *LocalDriver) Connect() error
func (*LocalDriver) DeleteFile ¶
func (d *LocalDriver) DeleteFile(path string) error
func (*LocalDriver) Disconnect ¶
func (d *LocalDriver) Disconnect() error
func (*LocalDriver) DownloadFile ¶
func (d *LocalDriver) DownloadFile(path string, targetPath string) error
func (*LocalDriver) Started ¶
func (d *LocalDriver) Started() bool
func (*LocalDriver) StreamFile ¶
func (d *LocalDriver) StreamFile(path string) (io.ReadCloser, error)
func (*LocalDriver) UploadFile ¶
func (d *LocalDriver) UploadFile(file LocalFile) (RemoteFile, error)
type RemoteFile ¶
type SftpDriver ¶
type SftpDriver struct {
Username string
Password string
Ip string
Port int
RootPath string
Connection *sftp.Client
IsStarted bool
}
func (*SftpDriver) Connect ¶
func (d *SftpDriver) Connect() error
func (*SftpDriver) DeleteFile ¶
func (d *SftpDriver) DeleteFile(path string) error
func (*SftpDriver) Disconnect ¶
func (d *SftpDriver) Disconnect() error
func (*SftpDriver) DownloadFile ¶
func (d *SftpDriver) DownloadFile(path string, targetPath string) error
func (*SftpDriver) Started ¶
func (d *SftpDriver) Started() bool
func (*SftpDriver) StreamFile ¶
func (d *SftpDriver) StreamFile(path string) (io.ReadCloser, error)
func (*SftpDriver) UploadFile ¶
func (d *SftpDriver) UploadFile(file LocalFile) (RemoteFile, error)
Click to show internal directories.
Click to hide internal directories.