mirror of
https://github.com/rclone/rclone.git
synced 2025-12-15 15:53:41 +00:00
Add options to Put, PutUnchecked and Update, add HashOption and speed up local
* Add options to Put, PutUnchecked and Update for all Fses * Use these to create HashOption * Implement this in local * Pass the option in fs.Copy This has the effect that we only calculate hashes we need to in the local Fs which speeds up transfers significantly.
This commit is contained in:
@@ -94,6 +94,27 @@ func (o *HTTPOption) Mandatory() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// HashesOption defines an option used to tell the local fs to limit
|
||||
// the number of hashes it calculates.
|
||||
type HashesOption struct {
|
||||
Hashes HashSet
|
||||
}
|
||||
|
||||
// Header formats the option as an http header
|
||||
func (o *HashesOption) Header() (key string, value string) {
|
||||
return "", ""
|
||||
}
|
||||
|
||||
// String formats the option into human readable form
|
||||
func (o *HashesOption) String() string {
|
||||
return fmt.Sprintf("HashesOption(%v)", o.Hashes)
|
||||
}
|
||||
|
||||
// Mandatory returns whether the option must be parsed or can be ignored
|
||||
func (o *HashesOption) Mandatory() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// OpenOptionAddHeaders adds each header found in options to the
|
||||
// headers map provided the key was non empty.
|
||||
func OpenOptionAddHeaders(options []OpenOption, headers map[string]string) {
|
||||
|
||||
Reference in New Issue
Block a user