I would like to understand how the iCloud drive works behind the scenes, specifically when sharing files between PC and iOS apps via iCloud drive. With the Microsoft iCloud program installed on Windows 10 it shows the iCloud drive in the file explorer:
- I assume it's just a shortcut to the C:\users\username\iCloudDrive directory?
- when you copy a file to the iCloudDrive it's copied to that local iCloudDrive directory?
- the "iCloud Drive" process running in the background checks for any changes to files and folders in that local directory? How? does it use the "last modified" datetime stamp or does the file system notify the process of a change?
- the process then copies the entire file to the iCloud service? It updates the status to "green checkmark"
- when a file changes in the iCloud what mechanism is used to update the local file?
- does it prevent one file overwriting the other if both change at the same time? Does it "lock" a file while it's being updated?
- Does the same mechanism apply to iOS app accessing files on the iCloudDrive (save to local file system first, background process handles with the syncing, locking, etc)?
- in the logs I see references to CheckIfToHydrateOrDehydrateFile. What does that mean in this context?
I do not work for Apple nor know for a fact how it works but here are my logical assumptions (with a lot of general technical knowledge) for each question.
I hope this helps to answer your questions.