MCPcopy
hub / github.com/rclone/rclone / preCopy

Method preCopy

cmd/bisync/queue.go:191–224  ·  view source on GitHub ↗

for setup code shared by both fastCopy and resyncDir

(ctx context.Context)

Source from the content-addressed store, hash-verified

189
190// for setup code shared by both fastCopy and resyncDir
191func (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
226func (b *bisyncRun) fastCopy(ctx context.Context, fsrc, fdst fs.Fs, files bilib.Names, queueName string) ([]Results, error) {
227 if b.InGracefulShutdown {

Callers 2

fastCopyMethod · 0.95
resyncDirMethod · 0.95

Calls 5

EqualFnMethod · 0.95
GetConfigFunction · 0.92
DebugfFunction · 0.92
WithSyncLoggerFunction · 0.92
NameMethod · 0.65

Tested by

no test coverage detected