for setup code shared by both fastCopy and resyncDir
(ctx context.Context)
| 189 | |
| 190 | // for setup code shared by both fastCopy and resyncDir |
| 191 | func (b *bisyncRun) preCopy(ctx context.Context) context.Context { |
| 192 | b.queueOpt.queueCI = fs.GetConfig(ctx) |
| 193 | b.queueOpt.ignoreListingChecksum = b.opt.IgnoreListingChecksum |
| 194 | b.queueOpt.ignoreListingModtime = !b.opt.Compare.Modtime |
| 195 | b.queueOpt.hashTypes = map[string]hash.Type{ |
| 196 | b.fs1.Name(): b.opt.Compare.HashType1, |
| 197 | b.fs2.Name(): b.opt.Compare.HashType2, |
| 198 | } |
| 199 | b.queueOpt.logger.LoggerFn = b.WriteResults |
| 200 | overridingEqual := false |
| 201 | if (b.opt.Compare.Modtime && b.opt.Compare.Checksum) || b.opt.Compare.DownloadHash { |
| 202 | overridingEqual = true |
| 203 | fs.Debugf(nil, "overriding equal") |
| 204 | // otherwise impossible in Sync, so override Equal |
| 205 | ctx = b.EqualFn(ctx) |
| 206 | } |
| 207 | if b.opt.ResyncMode == PreferOlder || b.opt.ResyncMode == PreferLarger || b.opt.ResyncMode == PreferSmaller { |
| 208 | overridingEqual = true |
| 209 | fs.Debugf(nil, "overriding equal") |
| 210 | ctx = b.EqualFn(ctx) |
| 211 | } |
| 212 | ctxCopyLogger := operations.WithSyncLogger(ctx, b.queueOpt.logger) |
| 213 | if b.opt.Compare.Checksum && (b.opt.Compare.NoSlowHash || b.opt.Compare.SlowHashSyncOnly) && b.opt.Compare.SlowHashDetected { |
| 214 | // set here in case !b.opt.Compare.Modtime |
| 215 | b.queueOpt.queueCI = fs.GetConfig(ctxCopyLogger) |
| 216 | if b.opt.Compare.NoSlowHash { |
| 217 | b.queueOpt.queueCI.CheckSum = false |
| 218 | } |
| 219 | if b.opt.Compare.SlowHashSyncOnly && !overridingEqual { |
| 220 | b.queueOpt.queueCI.CheckSum = true |
| 221 | } |
| 222 | } |
| 223 | return ctxCopyLogger |
| 224 | } |
| 225 | |
| 226 | func (b *bisyncRun) fastCopy(ctx context.Context, fsrc, fdst fs.Fs, files bilib.Names, queueName string) ([]Results, error) { |
| 227 | if b.InGracefulShutdown { |