dropbox

package
v0.0.0-...-e391311 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2015 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Dropbox interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFs

func NewFs(name, root string) (fs.Fs, error)

NewFs contstructs an FsDropbox from the path, container:path

Types

type FsDropbox

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

FsDropbox represents a remote dropbox server

func (*FsDropbox) Copy

func (f *FsDropbox) Copy(src fs.Object, remote string) (fs.Object, error)

Copy src to this remote using server side copy operations.

This is stored with the remote path given

It returns the destination Object and a possible error

Will only be called if src.Fs().Name() == f.Name()

If it isn't possible then return fs.ErrorCantCopy

func (*FsDropbox) DirMove

func (dstFs *FsDropbox) DirMove(src fs.Fs) error

Move src to this remote using server side move operations.

Will only be called if src.Fs().Name() == f.Name()

If it isn't possible then return fs.ErrorCantDirMove

If destination exists then return fs.ErrorDirExists

func (*FsDropbox) List

func (f *FsDropbox) List() fs.ObjectsChan

Walk the path returning a channel of FsObjects

func (*FsDropbox) ListDir

func (f *FsDropbox) ListDir() fs.DirChan

Walk the path returning a channel of FsObjects

func (*FsDropbox) Mkdir

func (f *FsDropbox) Mkdir() error

Mkdir creates the container if it doesn't exist

func (*FsDropbox) Move

func (dstFs *FsDropbox) Move(src fs.Object, remote string) (fs.Object, error)

Move src to this remote using server side move operations.

This is stored with the remote path given

It returns the destination Object and a possible error

Will only be called if src.Fs().Name() == f.Name()

If it isn't possible then return fs.ErrorCantMove

func (*FsDropbox) Name

func (f *FsDropbox) Name() string

The name of the remote (as passed into NewFs)

func (*FsDropbox) NewFsObject

func (f *FsDropbox) NewFsObject(remote string) fs.Object

Return an FsObject from a path

May return nil if an error occurred

func (*FsDropbox) Precision

func (f *FsDropbox) Precision() time.Duration

Return the precision

func (*FsDropbox) Purge

func (f *FsDropbox) Purge() error

Purge deletes all the files and the container

Optional interface: Only implement this if you have a way of deleting all the files quicker than just running Remove() on the result of List()

func (*FsDropbox) Put

func (f *FsDropbox) Put(in io.Reader, remote string, modTime time.Time, size int64) (fs.Object, error)

Put the object

Copy the reader in to the new object which is returned

The new object may have been created if an error is returned

func (*FsDropbox) Rmdir

func (f *FsDropbox) Rmdir() error

Rmdir deletes the container

Returns an error if it isn't empty

func (*FsDropbox) Root

func (f *FsDropbox) Root() string

The root of the remote (as passed into NewFs)

func (*FsDropbox) String

func (f *FsDropbox) String() string

String converts this FsDropbox to a string

type FsObjectDropbox

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

FsObjectDropbox describes a dropbox object

func (*FsObjectDropbox) Fs

func (o *FsObjectDropbox) Fs() fs.Fs

Return the parent Fs

func (*FsObjectDropbox) Md5sum

func (o *FsObjectDropbox) Md5sum() (string, error)

Md5sum returns the Md5sum of an object returning a lowercase hex string

func (*FsObjectDropbox) ModTime

func (o *FsObjectDropbox) ModTime() time.Time

ModTime returns the modification time of the object

It attempts to read the objects mtime and if that isn't present the LastModified returned in the http headers

func (*FsObjectDropbox) Open

func (o *FsObjectDropbox) Open() (in io.ReadCloser, err error)

Open an object for read

func (*FsObjectDropbox) Remote

func (o *FsObjectDropbox) Remote() string

Return the remote path

func (*FsObjectDropbox) Remove

func (o *FsObjectDropbox) Remove() error

Remove an object

func (*FsObjectDropbox) SetModTime

func (o *FsObjectDropbox) SetModTime(modTime time.Time)

Sets the modification time of the local fs object

Commits the datastore

func (*FsObjectDropbox) Size

func (o *FsObjectDropbox) Size() int64

Size returns the size of an object in bytes

func (*FsObjectDropbox) Storable

func (o *FsObjectDropbox) Storable() bool

Is this object storable

func (*FsObjectDropbox) String

func (o *FsObjectDropbox) String() string

Return a string version

func (*FsObjectDropbox) Update

func (o *FsObjectDropbox) Update(in io.Reader, modTime time.Time, size int64) error

Update the already existing object

Copy the reader into the object updating modTime and size

The new object may have been created if an error is returned

type NameTreeFileWalkFunc

type NameTreeFileWalkFunc func(caseCorrectFilePath string, entry *dropbox.Entry)

type NameTreeNode

type NameTreeNode struct {
	// Map from lowercase directory name to tree node
	Directories map[string]*NameTreeNode

	// Map from file name (case sensitive) to dropbox entry
	Files map[string]*dropbox.Entry

	// Empty string if exact case is unknown or root node
	CaseCorrectName string
}

func NewNameTree

func NewNameTree() *NameTreeNode

func (*NameTreeNode) GetPathWithCorrectCase

func (tree *NameTreeNode) GetPathWithCorrectCase(path string) *string

func (*NameTreeNode) PutCaseCorrectDirectoryName

func (tree *NameTreeNode) PutCaseCorrectDirectoryName(parentPath string, caseCorrectDirectoryName string)

func (*NameTreeNode) PutFile

func (tree *NameTreeNode) PutFile(parentPath string, caseCorrectFileName string, dropboxEntry *dropbox.Entry)

func (*NameTreeNode) String

func (tree *NameTreeNode) String() string

func (*NameTreeNode) WalkFiles

func (tree *NameTreeNode) WalkFiles(rootPath string, walkFunc NameTreeFileWalkFunc)

Jump to

Keyboard shortcuts

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