mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 14:51:48 +08:00
s3,swift: Add --use-server-modtime
`--use-server-modtime` stops s3 and swift retrieving the modtime from metadata which enables a fast sync mode with the `--update` flag.
This commit is contained in:
parent
6b67489133
commit
1db68571fd
|
@ -945,6 +945,9 @@ func (o *Object) readMetaData() (err error) {
|
|||
// It attempts to read the objects mtime and if that isn't present the
|
||||
// LastModified returned in the http headers
|
||||
func (o *Object) ModTime() time.Time {
|
||||
if fs.Config.UseServerModTime {
|
||||
return o.lastModified
|
||||
}
|
||||
err := o.readMetaData()
|
||||
if err != nil {
|
||||
fs.Logf(o, "Failed to read metadata: %v", err)
|
||||
|
|
|
@ -719,6 +719,9 @@ func (o *Object) readMetaData() (err error) {
|
|||
// It attempts to read the objects mtime and if that isn't present the
|
||||
// LastModified returned in the http headers
|
||||
func (o *Object) ModTime() time.Time {
|
||||
if fs.Config.UseServerModTime {
|
||||
return o.info.LastModified
|
||||
}
|
||||
err := o.readMetaData()
|
||||
if err != nil {
|
||||
fs.Debugf(o, "Failed to read metadata: %s", err)
|
||||
|
|
|
@ -799,6 +799,19 @@ This can be useful when transferring to a remote which doesn't support
|
|||
mod times directly as it is more accurate than a `--size-only` check
|
||||
and faster than using `--checksum`.
|
||||
|
||||
### --use-server-modtime ###
|
||||
|
||||
Some object-store backends (e.g, Swift, S3) do not preserve file modification
|
||||
times (modtime). On these backends, rclone stores the original modtime as
|
||||
additional metadata on the object. By default it will make an API call to
|
||||
retrieve the metadata when the modtime is needed by an operation.
|
||||
|
||||
Use this flag to disable the extra API call and rely instead on the server's
|
||||
modified time. In cases such as a local to remote sync, knowing the local file
|
||||
is newer than the time it was last uploaded to the remote is sufficient. In
|
||||
those cases, this flag can speed up the process and reduce the number of API
|
||||
calls necessary.
|
||||
|
||||
### -v, -vv, --verbose ###
|
||||
|
||||
With `-v` rclone will tell you about each file that is transferred and
|
||||
|
|
|
@ -213,6 +213,19 @@ This remote supports `--fast-list` which allows you to use fewer
|
|||
transactions in exchange for more memory. See the [rclone
|
||||
docs](/docs/#fast-list) for more details.
|
||||
|
||||
### --update and --use-server-modtime ###
|
||||
|
||||
As noted below, the modified time is stored on metadata on the object. It is
|
||||
used by default for all operations that require checking the time a file was
|
||||
last updated. It allows rclone to treat the remote more like a true filesystem,
|
||||
but it is inefficient because it requires an extra API call to retrieve the
|
||||
metadata.
|
||||
|
||||
For many operations, the time the object was last uploaded to the remote is
|
||||
sufficient to determine if it is "dirty". By using `--update` along with
|
||||
`--use-server-modtime`, you can avoid the extra API call and simply upload
|
||||
files whose local modtime is newer than the time it was last uploaded.
|
||||
|
||||
### Modified time ###
|
||||
|
||||
The modified time is stored as metadata on the object as
|
||||
|
|
|
@ -248,6 +248,19 @@ This remote supports `--fast-list` which allows you to use fewer
|
|||
transactions in exchange for more memory. See the [rclone
|
||||
docs](/docs/#fast-list) for more details.
|
||||
|
||||
### --update and --use-server-modtime ###
|
||||
|
||||
As noted below, the modified time is stored on metadata on the object. It is
|
||||
used by default for all operations that require checking the time a file was
|
||||
last updated. It allows rclone to treat the remote more like a true filesystem,
|
||||
but it is inefficient because it requires an extra API call to retrieve the
|
||||
metadata.
|
||||
|
||||
For many operations, the time the object was last uploaded to the remote is
|
||||
sufficient to determine if it is "dirty". By using `--update` along with
|
||||
`--use-server-modtime`, you can avoid the extra API call and simply upload
|
||||
files whose local modtime is newer than the time it was last uploaded.
|
||||
|
||||
### Specific options ###
|
||||
|
||||
Here are the command line options specific to this cloud storage
|
||||
|
|
|
@ -67,6 +67,7 @@ type ConfigInfo struct {
|
|||
StreamingUploadCutoff SizeSuffix
|
||||
StatsFileNameLength int
|
||||
AskPassword bool
|
||||
UseServerModTime bool
|
||||
}
|
||||
|
||||
// NewConfig creates a new config with everything set to the default
|
||||
|
|
|
@ -58,6 +58,7 @@ func AddFlags(flagSet *pflag.FlagSet) {
|
|||
flags.BoolVarP(flagSet, &fs.Config.TrackRenames, "track-renames", "", fs.Config.TrackRenames, "When synchronizing, track file renames and do a server side move if possible")
|
||||
flags.IntVarP(flagSet, &fs.Config.LowLevelRetries, "low-level-retries", "", fs.Config.LowLevelRetries, "Number of low level retries to do.")
|
||||
flags.BoolVarP(flagSet, &fs.Config.UpdateOlder, "update", "u", fs.Config.UpdateOlder, "Skip files that are newer on the destination.")
|
||||
flags.BoolVarP(flagSet, &fs.Config.UseServerModTime, "use-server-modtime", "", fs.Config.UseServerModTime, "Use server modified time instead of object metadata")
|
||||
flags.BoolVarP(flagSet, &fs.Config.NoGzip, "no-gzip-encoding", "", fs.Config.NoGzip, "Don't set Accept-Encoding: gzip.")
|
||||
flags.IntVarP(flagSet, &fs.Config.MaxDepth, "max-depth", "", fs.Config.MaxDepth, "If set limits the recursion depth to this.")
|
||||
flags.BoolVarP(flagSet, &fs.Config.IgnoreSize, "ignore-size", "", false, "Ignore size when skipping use mod-time or checksum.")
|
||||
|
|
Loading…
Reference in New Issue
Block a user