storage

package
v0.0.0-...-45df14b Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2016 License: Apache-2.0 Imports: 23 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudFilesStorage

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

func NewCloudFiles

func NewCloudFiles(creds *common.RackspaceCreds, bucket string) (*CloudFilesStorage, error)

func (*CloudFilesStorage) Download

func (cf *CloudFilesStorage) Download(filename string, writer io.Writer) error

func (*CloudFilesStorage) List

func (cf *CloudFilesStorage) List(dc crypto.Decryptor) ([]*FileInfo, error)

func (*CloudFilesStorage) Start

func (cf *CloudFilesStorage) Start() error

func (*CloudFilesStorage) Stop

func (cf *CloudFilesStorage) Stop() error

func (*CloudFilesStorage) Upload

func (cf *CloudFilesStorage) Upload(filename string, reader io.ReadSeeker) error

type DownloadQueue

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

func NewDownloadQueue

func NewDownloadQueue(dl Downloader) *DownloadQueue

TODO: interface? meh.

func (*DownloadQueue) Add

func (dq *DownloadQueue) Add(conf *common.Conf, fi *FileInfo, dchan chan *FileDownload) *FileDownload

func (*DownloadQueue) Start

func (dq *DownloadQueue) Start() error

func (*DownloadQueue) Stop

func (dq *DownloadQueue) Stop() error

type DownloadTorrenter

type DownloadTorrenter interface {
	DownloadTorrent(filename string, writer io.Writer) error
}

type Downloader

type Downloader interface {
	// Downloads remote filename to io.Writer.
	Download(filename string, writer io.Writer) error
}

type FileDownload

type FileDownload struct {
	FileInfo *FileInfo

	Error error
	// contains filtered or unexported fields
}

func (*FileDownload) Done

func (fd *FileDownload) Done(err error)

func (*FileDownload) Start

func (fd *FileDownload) Start()

func (*FileDownload) Stop

func (fd *FileDownload) Stop() error

func (*FileDownload) TransferRate

func (fd *FileDownload) TransferRate() string

type FileInfo

type FileInfo struct {
	Name         string
	LastModified time.Time
	Length       int64
}

TODO: hash of file? Other attributes?

type Lister

type Lister interface {
	// Returns a list of available files to download. dc will
	// optionally decrypt filenames if requested.
	List(dc crypto.Decryptor) ([]*FileInfo, error)
}

type PeerDownloader

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

func (*PeerDownloader) Download

func (pd *PeerDownloader) Download(filename string, writer io.Writer) error

func (*PeerDownloader) Start

func (pd *PeerDownloader) Start() error

func (*PeerDownloader) Stop

func (pd *PeerDownloader) Stop() error

type PersistentDownloader

type PersistentDownloader interface {
	Downloader
	Start() error
	Stop() error
}

func NewPeerDownloader

func NewPeerDownloader(conf *common.Conf) (PersistentDownloader, error)

func NewPersistentDownloader

func NewPersistentDownloader(c *common.Conf) (PersistentDownloader, error)

type S3Storage

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

func NewS3

func NewS3(creds *common.AwsCreds, bucket string) (*S3Storage, error)

func (*S3Storage) Download

func (s *S3Storage) Download(filename string, writer io.Writer) error

func (*S3Storage) DownloadTorrent

func (s *S3Storage) DownloadTorrent(filename string, writer io.Writer) error

func (*S3Storage) List

func (s *S3Storage) List(dc crypto.Decryptor) ([]*FileInfo, error)

func (*S3Storage) Start

func (s *S3Storage) Start() error

func (*S3Storage) Stop

func (s *S3Storage) Stop() error

func (*S3Storage) Upload

func (s *S3Storage) Upload(filename string, reader io.ReadSeeker) error

Uploads to S3, and touches .distsync on success. which `notify.S3Poller` uses to find changes.

type SizeReader

type SizeReader interface {
	io.Reader
	// returns remaining bytes.
	// TODO: should this just be Size() or Len()?
	DistsyncSize() int64
}

type Storage

type Storage interface {
	Uploader
	Downloader
	Lister
}

func NewFromConf

func NewFromConf(c *common.Conf) (Storage, error)

type TorrentDownloader

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

func NewTorrentDownloader

func NewTorrentDownloader(conf *common.Conf) (*TorrentDownloader, error)

func (*TorrentDownloader) Download

func (td *TorrentDownloader) Download(filename string, writer io.Writer) error

func (*TorrentDownloader) Start

func (td *TorrentDownloader) Start() error

func (*TorrentDownloader) Stop

func (td *TorrentDownloader) Stop() error

type Uploader

type Uploader interface {
	// Upload with this remote filename.
	// See https://code.google.com/p/go/issues/detail?id=6738 for discussion
	// of sized / length'ed readers -- this uses .Seek to calcualte
	// the file size.
	Upload(filename string, reader io.ReadSeeker) error
}

Jump to

Keyboard shortcuts

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