Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Case

Action

synStore is called to upload a new file to Synapse.A new entry is made in the Cache Map.

synStore is called to upload a File object which has already been uploaded to Synapse.

(i.e. same name, Synapse ID, file path, parent, etc.)

  1. The associated 'last modified' time in the File Cache is compared to the 'last modified' time for the file. 
  2. If the timestamps are the same no upload occurs. 
  3. Otherwise the file is uploaded (generating a new FileHandle ID) 
  4. A new Cache Map entry is created with the FileHandleID and timestamp. 

The old entry is left in place, since some other in-memory File object may reference the same local file.

synGet is called for a File object which has not been downloaded locally.
  1. The File metadata are retrieved, including the FileHandleID.
  2. Since there is no entry in the Cache Map, the file is downloaded and an entry made in the Cache Map.
synGet is called for a File object which has been downloaded locally with a different target location.
  1. The File metadata are retrieved, including the FileHandle ID.  
  2. An entry is found in the Cache Map for the given FileHandle ID, but not for the given location. 
  3. If any currently downloaded file in the Cache Map for the FileHandle ID has an unchanged 'last modified' timestamp, it is copied to the new location.
  4. Otherwise, the file is downloaded from Synapse to the new location.  
  5. A new Cache Map entry is created for the new file.  

We do NOT make the new File object point to the cached file, since unexpected behavior would result when multiple File objects modify the same on-disk file.

synGet is called for a File object which has been downloaded locally with the same target location.
  1. The File metadata are retrieved, including the FileHandle ID.   
  2. An entry is found in the Cache Map for the given FileHandle ID and location.  
  3. If the cached timestamp matches the 'last modified' timestamp for the file, no download occurs. 
  4. If the local file is *missing*, then the file is downloaded.  
  5. Otherwise, the action depends on the "ifcollision" mode specified for synGet:  
    1. "overwriteLocaloverwrite.local":  The file is downloaded to the target location and the Cache Map entry is updated with a new timestamp;
    2. "keepLocalkeep.local":  No download occurs.  The File references the locally modified file at the given location;
    3. "keepBothkeep.both":  The file is downloaded to the target location, but given a modified local file name.  A second entry for the FileHandle ID is made in the Cache Map.

...