Documentation ¶
Overview ¶
Drive interface
Index ¶
- func NewFs(name, path string) (fs.Fs, error)
- type FsDrive
- func (f *FsDrive) Copy(src fs.Object, remote string) (fs.Object, error)
- func (f *FsDrive) CreateDir(pathId, leaf string) (newId string, err error)
- func (dstFs *FsDrive) DirMove(src fs.Fs) error
- func (f *FsDrive) FindLeaf(pathId, leaf string) (pathIdOut string, found bool, err error)
- func (f *FsDrive) List() fs.ObjectsChan
- func (f *FsDrive) ListDir() fs.DirChan
- func (f *FsDrive) Mkdir() error
- func (dstFs *FsDrive) Move(src fs.Object, remote string) (fs.Object, error)
- func (f *FsDrive) Name() string
- func (f *FsDrive) NewFsObject(remote string) fs.Object
- func (fs *FsDrive) Precision() time.Duration
- func (f *FsDrive) Purge() error
- func (f *FsDrive) Put(in io.Reader, remote string, modTime time.Time, size int64) (fs.Object, error)
- func (f *FsDrive) Rmdir() error
- func (f *FsDrive) Root() string
- func (f *FsDrive) String() string
- func (f *FsDrive) Upload(in io.Reader, size int64, contentType string, info *drive.File, remote string) (*drive.File, error)
- type FsObjectDrive
- func (o *FsObjectDrive) Fs() fs.Fs
- func (o *FsObjectDrive) Md5sum() (string, error)
- func (o *FsObjectDrive) ModTime() time.Time
- func (o *FsObjectDrive) Open() (in io.ReadCloser, err error)
- func (o *FsObjectDrive) Remote() string
- func (o *FsObjectDrive) Remove() error
- func (o *FsObjectDrive) SetModTime(modTime time.Time)
- func (o *FsObjectDrive) Size() int64
- func (o *FsObjectDrive) Storable() bool
- func (o *FsObjectDrive) String() string
- func (o *FsObjectDrive) Update(in io.Reader, modTime time.Time, size int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FsDrive ¶
type FsDrive struct {
// contains filtered or unexported fields
}
FsDrive represents a remote drive server
func (*FsDrive) Copy ¶
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 (*FsDrive) DirMove ¶
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 (*FsDrive) List ¶
func (f *FsDrive) List() fs.ObjectsChan
Walk the path returning a channel of FsObjects
func (*FsDrive) Move ¶
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 (*FsDrive) Purge ¶
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 (*FsDrive) Put ¶
func (f *FsDrive) Put(in io.Reader, remote string, modTime time.Time, size int64) (fs.Object, error)
Put the object
This assumes that the object doesn't not already exists - if you call it when it does exist then it will create a duplicate. Call object.Update() in this case.
Copy the reader in to the new object which is returned ¶
The new object may have been created if an error is returned
type FsObjectDrive ¶
type FsObjectDrive struct {
// contains filtered or unexported fields
}
FsObjectDrive describes a drive object
func (*FsObjectDrive) Md5sum ¶
func (o *FsObjectDrive) Md5sum() (string, error)
Md5sum returns the Md5sum of an object returning a lowercase hex string
func (*FsObjectDrive) ModTime ¶
func (o *FsObjectDrive) 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 (*FsObjectDrive) Open ¶
func (o *FsObjectDrive) Open() (in io.ReadCloser, err error)
Open an object for read
func (*FsObjectDrive) SetModTime ¶
func (o *FsObjectDrive) SetModTime(modTime time.Time)
Sets the modification time of the drive fs object
func (*FsObjectDrive) Size ¶
func (o *FsObjectDrive) Size() int64
Size returns the size of an object in bytes