...
The analytical clients provide for client-side caching of Synapse files, to avoid unnecessarily retrieving (large or many) files that are already available locally. When a file is uploaded or downloaded the client keeps track of the location along with information to determine if it is later changed. Specifically, the client maintains a "Cache Map" whose keys are Synapse FileHandle IDs local file locations and whose values are lists of local file locations. Each file location has (1) a path on the local file system, and (2) a 'last modified' time. The UTC last-modified-on times. The use of this map is as follows:
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.) |
|
...
|
...
|
...
|
...
|
...
|
...
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. |
...
|
...
|
...
...
synGet is called for a File object which has been downloaded |
...
locally with a different target location. |
...
|
...
|
...
|
...
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. |
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
When a file is downloaded, specifying the file location is optional. If it isn't specified the file is placed in a default 'cache folder'. The organization of the file cache is:
...