MCPcopy
hub / github.com/rclone/rclone / setResyncConfig

Method setResyncConfig

cmd/bisync/resync.go:187–207  ·  view source on GitHub ↗

* --resync-mode implementation: PreferPath1: set ci.IgnoreExisting true, then false PreferPath2: set ci.IgnoreExisting false, then true PreferNewer: set ci.UpdateOlder in both directions PreferOlder: override EqualFn to implement custom logic PreferLarger: override EqualFn to implement c

(ctx context.Context)

Source from the content-addressed store, hash-verified

185 PreferSmaller: override EqualFn to implement custom logic
186*/
187func (b *bisyncRun) setResyncConfig(ctx context.Context) context.Context {
188 ci := fs.GetConfig(ctx)
189 switch b.opt.ResyncMode {
190 case PreferPath1:
191 if !b.resyncIs1to2 { // 2to1 (remember 2to1 is first)
192 ci.IgnoreExisting = true
193 } else { // 1to2
194 ci.IgnoreExisting = false
195 }
196 case PreferPath2:
197 if !b.resyncIs1to2 { // 2to1 (remember 2to1 is first)
198 ci.IgnoreExisting = false
199 } else { // 1to2
200 ci.IgnoreExisting = true
201 }
202 case PreferNewer:
203 ci.UpdateOlder = true
204 }
205 // for older, larger, and smaller, we return it unchanged and handle it later
206 return ctx
207}
208
209func (b *bisyncRun) resyncWhichIsWhich(src, dst fs.ObjectInfo) (path1, path2 fs.ObjectInfo) {
210 if b.resyncIs1to2 {

Callers 1

resyncMethod · 0.95

Calls 1

GetConfigFunction · 0.92

Tested by

no test coverage detected