MCPcopy Index your code
hub / github.com/rclone/rclone / SrcOnly

Method SrcOnly

fs/sync/sync.go:1223–1269  ·  view source on GitHub ↗

SrcOnly have an object which is in the source only

(src fs.DirEntry)

Source from the content-addressed store, hash-verified

1221
1222// SrcOnly have an object which is in the source only
1223func (s *syncCopyMove) SrcOnly(src fs.DirEntry) (recurse bool) {
1224 if s.deleteMode == fs.DeleteModeOnly {
1225 return false
1226 }
1227 switch x := src.(type) {
1228 case fs.Object:
1229 s.logger(s.ctx, operations.MissingOnDst, x, nil, nil)
1230 s.markParentNotEmpty(src)
1231
1232 if s.trackRenames {
1233 // Save object to check for a rename later
1234 select {
1235 case <-s.ctx.Done():
1236 return
1237 case s.trackRenamesCh <- x:
1238 }
1239 } else {
1240 // Check CompareDest && CopyDest
1241 NoNeedTransfer, err := operations.CompareOrCopyDest(s.ctx, s.fdst, nil, x, s.compareCopyDest, s.backupDir)
1242 if err != nil {
1243 s.processError(err)
1244 s.logger(s.ctx, operations.TransferError, x, nil, err)
1245 }
1246 if !NoNeedTransfer {
1247 // No need to check since doesn't exist
1248 fs.Debugf(src, "Need to transfer - File not found at Destination")
1249 s.markDirModifiedObject(x)
1250 ok := s.toBeUploaded.Put(s.inCtx, fs.ObjectPair{Src: x, Dst: nil})
1251 if !ok {
1252 return
1253 }
1254 }
1255 }
1256 case fs.Directory:
1257 // Do the same thing to the entire contents of the directory
1258 s.markParentNotEmpty(src)
1259 s.logger(s.ctx, operations.MissingOnDst, src, nil, fs.ErrorIsDir)
1260
1261 // Create the directory and make sure the Metadata/ModTime is correct
1262 s.copyDirMetadata(s.ctx, s.fdst, nil, transform.Path(s.ctx, x.Remote(), true), x)
1263 s.markDirModified(transform.Path(s.ctx, x.Remote(), true))
1264 return true
1265 default:
1266 panic("Bad object in DirEntries")
1267 }
1268 return false
1269}
1270
1271// Match is called when src and dst are present, so sync src to dst
1272func (s *syncCopyMove) Match(ctx context.Context, dst, src fs.DirEntry) (recurse bool) {

Callers

nothing calls this directly

Calls 11

markParentNotEmptyMethod · 0.95
processErrorMethod · 0.95
markDirModifiedObjectMethod · 0.95
copyDirMetadataMethod · 0.95
markDirModifiedMethod · 0.95
CompareOrCopyDestFunction · 0.92
DebugfFunction · 0.92
PathFunction · 0.92
PutMethod · 0.65
RemoteMethod · 0.65
DoneMethod · 0.45

Tested by

no test coverage detected