fetchContent incremental updates

I am implementing a NSFileProviderReplicatedExtension that will take advantage of rsync incremental update capabilities.

In the fetchContent function when my file is already materialised I would like to copy the already materialised item in place of the temp URL in order to prevent the full reload of the item every time the system requests the reload

My issue is then how to get to the local URL of the materialised item from the NSFileProviderItemIdentifier ?

I can most likely re-create the path from a query on the server side but hoping there is a better way ?

Thanks,

If the file is already on disk, your FileProvider extension should not receive new fetchContent requests, unless your extension has provided an updated contentVersion for the item on a working set or directory enumerator. Or, your extension has returned shouldFetchContent=YES on the createItem or modifyItem completion handler.

If the file is already on disk, and your extension indicated to the system that it should download a new contentVersion. Your extension may implement the NSFileProviderIncrementalContentFetching protocol on the extension's principal class. (https://developer.apple.com/documentation/fileprovider/nsfileproviderincrementalcontentfetching)

The system will pass to your extension the existing content, and content version, as method parameters. Your extension can use the existing content, plus any new data it wishes to pull from a server, to construct the new version of the file which the system is requesting. After your extension has constructed the new version of the file, pass the URL to that file on the completion handler to the incremental content fetching method.

@clenart: Thanks for the tip on the incremental fetching protocol, I added it to my FileProviderReplicatedExtension class and it works like a charm.

As to the underlying issue I still have no clue why the fetchContent gets called every other time after completion of the modifyItem even-though I call the completion handler with "false" for the shouldFetchContent argument ( not sure why you say it should not be YES since it is a Bool ? )

Here is the log when the fetchContent gets called:

┳6b75e ✅ done executing <J1 ✅ update-item(propagated:<docID(379724) dbver:41 domver:> diffs:content|mtime) why:itemChangedRemotely|contentUpdate sched:utility#1672892736.451466> → <actual:<s:38549 p:23159 n:"t{5}3.jpg" doc sz:14218717 m:rw-%<0> ct:1669218682.0 mt:1672892568.0 lu:1672892596.0 unsupported:tags|favoriteRank|xattrs|typeAndCreator v:sver:MV1 cver:CV1 nsattr:<cap:rwd-f-e- ul:uploaded deco:<com.iointegration.ioapp.XinetFP.Extension.registered> userInfo:<3 keys> cp:lazy>> requested:<p:23159 n:"t{5}3.jpg" doc sz:14218717 m:rw- ct:1669218682.0 mt:1672892736.0106895 lu:1672892182.0 ostype:NSFileProviderTypeAndCreator(type: 1246774599, creator: 943868237)> stillPending: shouldFetch:false>

 ✍️ FP snapshot mutation: update<s:38549 p:23159 n:"t{5}3.jpg" doc sz:14218717 m:rw-%<0> ct:1669218682.0 mt:1672892568.0 lu:1672892596.0 unsupported:tags|favoriteRank|xattrs|typeAndCreator v:sver:MV1 cver:CV1 nsattr:<cap:rwd-f-e- ul:uploaded deco:<com.iointegration.ioapp.XinetFP.Extension.registered> userInfo:<3 keys> cp:lazy>> diffs:lastUsedDate|mtime why:item propagated

 ✍️ persist job: <FP1 ⏯ fetch-content(38549) why:itemChangedRemotely sched:utility#1672892736.451466>

And the log when it is not called:

┳6bb0b ✅ done executing <J1 ✅ update-item(propagated:<docID(379724) dbver:43 domver:> diffs:content|mtime) why:itemChangedRemotely|contentUpdate sched:utility#1672892875.642271> → <actual:<s:38549 p:23159 n:"t{5}3.jpg" doc sz:14217550 m:rw-%<0> ct:1669218682.0 mt:1672892736.0 lu:1672892752.0 unsupported:tags|favoriteRank|xattrs|typeAndCreator v:sver:MV1 cver:CV1 nsattr:<cap:rwd-f-e- ul:uploaded deco:<com.iointegration.ioapp.XinetFP.Extension.registered> userInfo:<3 keys> cp:lazy>> requested:<p:23159 n:"t{5}3.jpg" doc sz:14217550 m:rw- ct:1669218682.0 mt:1672892875.420792 lu:1672892750.0 ostype:NSFileProviderTypeAndCreator(type: 1246774599, creator: 943868237)> stillPending: shouldFetch:false>

 ✍️ FP snapshot mutation: update<s:38549 p:23159 n:"t{5}3.jpg" doc sz:14217550 m:rw-%<0> ct:1669218682.0 mt:1672892736.0 lu:1672892752.0 unsupported:tags|favoriteRank|xattrs|typeAndCreator v:sver:MV1 cver:CV1 nsattr:<cap:rwd-f-e- ul:uploaded deco:<com.iointegration.ioapp.XinetFP.Extension.registered> userInfo:<3 keys> cp:lazy>> diffs:content|lastUsedDate|userInfo why:item propagated

 ✍️ persist job: <J1 ⏯ update-item(propagated:<38549 dbver:30 domver:> diffs:lastUsedDate|mtime|evictable) why:itemChangedRemotely sched:utility#1672892875.642271>

Thanks for your help again,

fetchContent incremental updates
 
 
Q