diff options
Diffstat (limited to 'weed/shell/command_remote_mount.go')
| -rw-r--r-- | weed/shell/command_remote_mount.go | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/weed/shell/command_remote_mount.go b/weed/shell/command_remote_mount.go index f7869e221..a0d41ce6f 100644 --- a/weed/shell/command_remote_mount.go +++ b/weed/shell/command_remote_mount.go @@ -178,8 +178,8 @@ func (c *commandRemoteMount) pullMetadata(commandEnv *CommandEnv, writer io.Writ Name: name, IsDirectory: isDirectory, Attributes: &filer_pb.FuseAttributes{ - FileSize: uint64(remoteEntry.Size), - Mtime: remoteEntry.LastModifiedAt, + FileSize: uint64(remoteEntry.RemoteSize), + Mtime: remoteEntry.RemoteMtime, FileMode: uint32(0644), }, RemoteEntry: remoteEntry, @@ -187,15 +187,8 @@ func (c *commandRemoteMount) pullMetadata(commandEnv *CommandEnv, writer io.Writ }) return createErr } else { - if existingEntry.RemoteEntry == nil || existingEntry.RemoteEntry.ETag != remoteEntry.ETag { - existingEntry.RemoteEntry = remoteEntry - existingEntry.Attributes.FileSize = uint64(remoteEntry.Size) - existingEntry.Attributes.Mtime = remoteEntry.LastModifiedAt - _, updateErr := client.UpdateEntry(ctx, &filer_pb.UpdateEntryRequest{ - Directory: localDir, - Entry: existingEntry, - }) - return updateErr + if existingEntry.RemoteEntry == nil || existingEntry.RemoteEntry.RemoteETag != remoteEntry.RemoteETag { + return doSaveRemoteEntry(client, localDir, existingEntry, remoteEntry) } } return nil @@ -240,3 +233,17 @@ func (c *commandRemoteMount) saveMountMapping(commandEnv *CommandEnv, writer io. return nil } + +func doSaveRemoteEntry(client filer_pb.SeaweedFilerClient, localDir string, existingEntry *filer_pb.Entry, remoteEntry *filer_pb.RemoteEntry) error { + existingEntry.RemoteEntry = remoteEntry + existingEntry.Attributes.FileSize = uint64(remoteEntry.RemoteSize) + existingEntry.Attributes.Mtime = remoteEntry.RemoteMtime + _, updateErr := client.UpdateEntry(context.Background(), &filer_pb.UpdateEntryRequest{ + Directory: localDir, + Entry: existingEntry, + }) + if updateErr != nil { + return updateErr + } + return nil +}
\ No newline at end of file |
