backend

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoBackend = fmt.Errorf("no supported backend")

Functions

func Register

func Register(scheme string, creator func(u *url.URL) (Backend, error))

Types

type Backend

type Backend interface {
	URI() string
	Write(path string, date time.Time, data io.Reader) error
	List(path string) ([]File, error)
	Read(path string) (File, error)
}

func Load

func Load(connection string) (Backend, error)

func NewFile

func NewFile(root string) Backend

func NewSFTP

func NewSFTP(sftpClient *sftp.Client, sshClient *ssh.Client, root string) Backend

type Closer

type Closer interface {
	Close() error
}

type File

type File interface {
	Name() string
	Versions() []time.Time
	IsDir() bool
	Data(time.Time) (io.ReadCloser, error)
}

type FileBackend

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

func (*FileBackend) List

func (b *FileBackend) List(p string) ([]File, error)

func (*FileBackend) Read

func (b *FileBackend) Read(p string) (File, error)

func (*FileBackend) URI

func (b *FileBackend) URI() string

func (*FileBackend) Write

func (b *FileBackend) Write(p string, t time.Time, data io.Reader) error

type FileFile

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

func (*FileFile) Data

func (f *FileFile) Data(t time.Time) (io.ReadCloser, error)

func (*FileFile) IsDir

func (f *FileFile) IsDir() bool

func (*FileFile) Name

func (f *FileFile) Name() string

func (*FileFile) Versions

func (f *FileFile) Versions() []time.Time

type S3Backend

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

func (*S3Backend) List

func (b *S3Backend) List(p string) ([]File, error)

func (*S3Backend) Read

func (b *S3Backend) Read(p string) (File, error)

func (*S3Backend) URI

func (b *S3Backend) URI() string

func (*S3Backend) Write

func (b *S3Backend) Write(p string, t time.Time, data io.Reader) error

type S3File

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

func (*S3File) Data

func (f *S3File) Data(t time.Time) (io.ReadCloser, error)

func (*S3File) IsDir

func (f *S3File) IsDir() bool

func (*S3File) Name

func (f *S3File) Name() string

func (*S3File) Versions

func (f *S3File) Versions() []time.Time

type SFTPBackend

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

func (*SFTPBackend) Close

func (b *SFTPBackend) Close() error

func (*SFTPBackend) List

func (b *SFTPBackend) List(p string) ([]File, error)

func (*SFTPBackend) Read

func (b *SFTPBackend) Read(p string) (File, error)

func (*SFTPBackend) URI

func (b *SFTPBackend) URI() string

func (*SFTPBackend) Write

func (b *SFTPBackend) Write(p string, t time.Time, data io.Reader) error

type SFTPFile

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

func (*SFTPFile) Data

func (f *SFTPFile) Data(t time.Time) (io.ReadCloser, error)

func (*SFTPFile) IsDir

func (f *SFTPFile) IsDir() bool

func (*SFTPFile) Name

func (f *SFTPFile) Name() string

func (*SFTPFile) Versions

func (f *SFTPFile) Versions() []time.Time

Jump to

Keyboard shortcuts

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