Documentation
¶
Index ¶
- Constants
- Variables
- type EncryptedArchive
- type File
- type FileMeta
- type Handler
- func (me *Handler) Close() error
- func (me *Handler) DecryptDirectory(dst string, src string, pw, pgpPrivateKey []byte) error
- func (me *Handler) EncryptDirectory(dst string, src string, pgpPublicKeys [][]byte) error
- func (me *Handler) FileMatchesQuery(fileHash, query string) bool
- func (me *Handler) FileNameByHash(fileHash string, fromMetaOnly bool, spUrl string) string
- func (me *Handler) HasThumbnail(spUrl, fileHash string) bool
- func (me *Handler) NotifyLastState()
- func (me *Handler) PrepareRegister(reg Register, publicKeys [][]byte) (EncryptedArchive, error)
- func (me *Handler) PrepareRegisterAndScheduleUpload(reg Register, publicKeys [][]byte, spUrl string) (encryptedArchive EncryptedArchive, err error)
- func (me *Handler) ReEncryptFile(spUrl, fileHash string, pgpPubKeys [][]byte) (string, error)
- func (me *Handler) Register(txHash, fileHash string, rdyForUpload bool) error
- func (me *Handler) RemoveFileAndMetaFromDisk(fileHash string)
- func (me *Handler) RemoveFileFromDiskKeepMeta(fileHash string)
- func (me *Handler) RemovePlainFromDisk(fileHash, filename string) error
- func (me *Handler) RequestFileFromSpp(spUrl, fileHash string) (string, error)
- func (me *Handler) SetListener(...)
- func (me *Handler) Thumbnail(spUrl, fileHash string, fromCacheOnly bool) (string, error)
- func (me *Handler) TryDownload(spUrl, fileHash string)
- type Pending
- type Register
- type ReqFile
- type TransferProgressCallback
- type Uploader
Constants ¶
View Source
const ( StatusDownload = "download" StatusUpload = "upload" StatusSuccess = "success" StatusPending = "pending" StatusFail = "fail" )
View Source
const (
FileMetaDBName = "filemetadb"
)
View Source
const (
PendingDBName = "pending"
)
Variables ¶
View Source
var ( ErrEmptySpURL = errors.New("empty spUrl") ErrDownloadTimeout = errors.New("download timeout") ErrPGPDecryptionFailed = errors.New("pgp decryption failed") ErrUploadTimeout = errors.New("upload timeout") )
View Source
var ErrFileMetaNotFound = errors.New("file meta not found")
View Source
var ErrNoBytesWritten = errors.New("No bytes written to file")
View Source
var ErrNoFileDefined = errors.New("No file defined")
Functions ¶
This section is empty.
Types ¶
type EncryptedArchive ¶
type Handler ¶
type Handler struct {
FileMetaHandler *handler
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) DecryptDirectory ¶
func (*Handler) EncryptDirectory ¶
func (*Handler) FileMatchesQuery ¶
func (*Handler) FileNameByHash ¶
func (*Handler) HasThumbnail ¶
Only checking on disk
func (*Handler) NotifyLastState ¶
func (me *Handler) NotifyLastState()
func (*Handler) PrepareRegister ¶
func (me *Handler) PrepareRegister(reg Register, publicKeys [][]byte) (EncryptedArchive, error)
Prepare the files on the filesystem but doesn't do anything with it yet. Use PrepareRegisterAndScheduleUpload if you want to schedule an upload too
func (*Handler) PrepareRegisterAndScheduleUpload ¶
func (me *Handler) PrepareRegisterAndScheduleUpload(reg Register, publicKeys [][]byte, spUrl string) (encryptedArchive EncryptedArchive, err error)
Prepares the files on disk and schedules an upload
func (*Handler) ReEncryptFile ¶
func (*Handler) RemoveFileAndMetaFromDisk ¶
func (*Handler) RemoveFileFromDiskKeepMeta ¶
func (*Handler) RemovePlainFromDisk ¶
func (*Handler) RequestFileFromSpp ¶
download from spp
func (*Handler) SetListener ¶
func (me *Handler) SetListener(f func(stype, fhash, spUrl, txHash, status, name string, percentage float32) error, notificationManager *notification.Manager, chanHub *channelhub.ChannelHub)
func (*Handler) TryDownload ¶
Tries only if the download isn't scheduled already
type TransferProgressCallback ¶
type TransferProgressCallback func(float32)
type Uploader ¶
type Uploader struct {
// contains filtered or unexported fields
}
func NewUploader ¶
func NewUploader(cfg *config.Configuration, accountGetter func() *account.Account, waitWorkerGrp *sync.WaitGroup, closing *bool, stopAll *chan bool, uploadDownloadSync *map[string]*uploadDownloadStatus, uploadDownloadSyncMutex *sync.Mutex, wallet *account.Wallet, userAccountDir string) (*Uploader, error)
Click to show internal directories.
Click to hide internal directories.