Documentation
¶
Overview ¶
Package huaweidrive implements the Huawei Drive backend for rclone
Index ¶
- func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error)
- type Fs
- func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error)
- func (f *Fs) ChangeNotify(ctx context.Context, notifyFunc func(string, fs.EntryType), ...)
- func (f *Fs) CleanUp(ctx context.Context) error
- func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, error)
- func (f *Fs) CreateDir(ctx context.Context, pathID, leaf string) (newID string, err error)
- func (f *Fs) DirCacheFlush()
- func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string) error
- func (f *Fs) Disconnect(ctx context.Context) error
- func (f *Fs) Features() *fs.Features
- func (f *Fs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut string, found bool, err error)
- func (f *Fs) Hashes() hash.Set
- func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error)
- func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) (err error)
- func (f *Fs) Mkdir(ctx context.Context, dir string) error
- func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, error)
- func (f *Fs) Name() string
- func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error)
- func (f *Fs) Precision() time.Duration
- func (f *Fs) Purge(ctx context.Context, dir string) error
- func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
- func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
- func (f *Fs) Rmdir(ctx context.Context, dir string) error
- func (f *Fs) Root() string
- func (f *Fs) String() string
- func (f *Fs) UserInfo(ctx context.Context) (map[string]string, error)
- type Object
- func (o *Object) Fs() fs.Info
- func (o *Object) Hash(ctx context.Context, t hash.Type) (string, error)
- func (o *Object) Metadata(ctx context.Context) (metadata fs.Metadata, err error)
- func (o *Object) MimeType(ctx context.Context) string
- func (o *Object) ModTime(ctx context.Context) time.Time
- func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.ReadCloser, err error)
- func (o *Object) Remote() string
- func (o *Object) Remove(ctx context.Context) error
- func (o *Object) SetMetadata(ctx context.Context, metadata fs.Metadata) error
- func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error
- func (o *Object) Size() int64
- func (o *Object) Storable() bool
- func (o *Object) String() string
- func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error)
- type Options
- type QueryFilter
- func (q *QueryFilter) AddDirectlyRecycled(directlyRecycled bool)
- func (q *QueryFilter) AddEditedTimeRange(operator string, editedTime time.Time)
- func (q *QueryFilter) AddFavorite(favorite bool)
- func (q *QueryFilter) AddFileName(fileName string)
- func (q *QueryFilter) AddFileNameContains(fileName string)
- func (q *QueryFilter) AddMimeType(mimeType string)
- func (q *QueryFilter) AddMimeTypeNot(mimeType string)
- func (q *QueryFilter) AddParentFolder(parentID string)
- func (q *QueryFilter) AddRecycled(recycled bool)
- func (q *QueryFilter) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Fs ¶
type Fs struct {
// contains filtered or unexported fields
}
Fs represents a remote Huawei Drive
func (*Fs) ChangeNotify ¶
func (f *Fs) ChangeNotify(ctx context.Context, notifyFunc func(string, fs.EntryType), pollIntervalChan <-chan time.Duration)
ChangeNotify calls the passed function with a path that has had changes. It polls the Huawei Drive Changes API at the given interval.
func (*Fs) 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 (*Fs) DirCacheFlush ¶
func (f *Fs) DirCacheFlush()
DirCacheFlush resets the directory cache - used in testing as an optional interface
func (*Fs) DirMove ¶
DirMove moves src, srcRemote to this remote at dstRemote 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 (*Fs) Disconnect ¶
Disconnect the current user by removing stored token
func (*Fs) FindLeaf ¶
func (f *Fs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut string, found bool, err error)
FindLeaf finds a directory of name leaf in the folder with ID pathID
func (*Fs) List ¶
List the objects and directories in dir into entries. The entries can be returned in any order but should be for a complete directory.
dir should be "" to list the root, and should not have trailing slashes.
This should return ErrDirNotFound if the directory isn't found.
func (*Fs) ListR ¶
ListR lists the objects and directories of the Fs starting from dir recursively into out.
dir should be "" to start from the root, and should not have trailing slashes.
This should return ErrDirNotFound if the directory isn't found.
It should call callback for each tranche of entries read. These need not be returned in any particular order. If callback returns an error then the listing will stop immediately.
Don't implement this unless you have a more efficient way of listing recursively that doing a directory traversal.
func (*Fs) 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
NOTE: Huawei Drive API has limitations with cross-directory moves: - Same-directory renames work perfectly - Cross-directory moves often fail silently (API returns success but file doesn't move) - We detect this by verifying the parentFolder after the API call - When detected, we return fs.ErrorCantMove to trigger rclone's copy+delete fallback
func (*Fs) NewObject ¶
NewObject finds the Object at remote. If it can't be found it returns the error fs.ErrorObjectNotFound.
func (*Fs) Purge ¶
Purge deletes all the files in the directory
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 (*Fs) Put ¶
func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
Put the object into the container
Copy the reader in to the new object which is returned.
The new object may have been created if an error is returned
func (*Fs) PutUnchecked ¶
func (f *Fs) PutUnchecked(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)
PutUnchecked the object into the container
This will produce duplicates if we haven't checked that there is an existing object first.
Copy the reader in to the new object which is returned.
The new object may have been created if an error is returned.
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object describes a Huawei Drive object
func (*Object) Metadata ¶
Metadata returns metadata for an object
It should return nil if there is no Metadata
func (*Object) ModTime ¶
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 (*Object) Open ¶
func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.ReadCloser, err error)
Open an object for read
func (*Object) SetMetadata ¶
SetMetadata sets metadata for an Object
It should return fs.ErrorNotImplemented if it can't set metadata
func (*Object) SetModTime ¶
SetModTime sets the modification time of the local fs object
Huawei Drive API does not support setting modification times, so this always returns ErrorCantSetModTime.
func (*Object) Update ¶
func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error)
Update the object with the contents of the io.Reader, modTime and size
If existing is set then it updates the object rather than creating a new one.
The new object may have been created if an error is returned
type Options ¶
type Options struct {
RootFolderID string `config:"root_folder_id"`
ChunkSize fs.SizeSuffix `config:"chunk_size"`
ListChunk int `config:"list_chunk"`
UploadCutoff fs.SizeSuffix `config:"upload_cutoff"`
Enc encoder.MultiEncoder `config:"encoding"`
}
Options defines the configuration for this backend
type QueryFilter ¶
type QueryFilter struct {
Conditions []string
}
QueryFilter represents a Huawei Drive query filter
func NewQueryFilter ¶
func NewQueryFilter() *QueryFilter
NewQueryFilter creates a new empty query filter
func (*QueryFilter) AddDirectlyRecycled ¶
func (q *QueryFilter) AddDirectlyRecycled(directlyRecycled bool)
AddDirectlyRecycled adds a directly recycled status filter condition
func (*QueryFilter) AddEditedTimeRange ¶
func (q *QueryFilter) AddEditedTimeRange(operator string, editedTime time.Time)
AddEditedTimeRange adds an edited time range filter condition
func (*QueryFilter) AddFavorite ¶
func (q *QueryFilter) AddFavorite(favorite bool)
AddFavorite adds a favorite status filter condition
func (*QueryFilter) AddFileName ¶
func (q *QueryFilter) AddFileName(fileName string)
AddFileName adds a file name filter condition
func (*QueryFilter) AddFileNameContains ¶
func (q *QueryFilter) AddFileNameContains(fileName string)
AddFileNameContains adds a file name contains filter condition
func (*QueryFilter) AddMimeType ¶
func (q *QueryFilter) AddMimeType(mimeType string)
AddMimeType adds a mime type filter condition
func (*QueryFilter) AddMimeTypeNot ¶
func (q *QueryFilter) AddMimeTypeNot(mimeType string)
AddMimeTypeNot adds a negative mime type filter condition
func (*QueryFilter) AddParentFolder ¶
func (q *QueryFilter) AddParentFolder(parentID string)
AddParentFolder adds a parent folder filter condition
func (*QueryFilter) AddRecycled ¶
func (q *QueryFilter) AddRecycled(recycled bool)
AddRecycled adds a recycled status filter condition
func (*QueryFilter) String ¶
func (q *QueryFilter) String() string
String returns the query filter as a string for the API