• There's not currently any way to pull some attachments automatically but not others. It's all or nothing.• Multiple calls to download the same attachment will issue redundant downloads, wasting network bandwidth. (Only one copy will be saved to disk, though.)• Attachment downloading isn't as fault-tolerant as regular replication: if there's no network connectivity or the server isn't reachable, the request will immediately fail. If the request fails, it won't be retried automatically.• If you retry an interrupted download, it starts over from the beginning instead of where it left off.• There's no way yet to cancel or pause a download.• There's no way to "un-download" an attachment, i.e. purge an attachment from local storage.
On Aug 7, 2015, at 10:08 AM, Brett Harrison <brett.h...@zyamusic.com> wrote:
I submitted the C# pull request. I believe I could alter my API to more closely match yours from what I have seen. I would most likely wait until yours is more finalized.
Currently the major differences that I have vs. you features are:- I don't currently expose a progress callback
- I do combine requests that would pull the same object based on the digest (so only one network request would be made)
- I throttle the number of simultaneous network requests to 4 (configurable), so that the network does not get choked with too many requests at once.
- I created a new replication "AttachmentPuller" to do this work instead of adding to the current Puller.
On Aug 9, 2015, at 7:43 PM, atom992 <yangzi...@gmail.com> wrote:
Is there a plan for android about the ‘feature/lazy_attachments’?
On Aug 7, 2015, at 10:08 AM, Brett Harrison <brett.h...@zyamusic.com> wrote:I submitted the C# pull request. I believe I could alter my API to more closely match yours from what I have seen. I would most likely wait until yours is more finalized.Hi Brett! That sounds great.Currently the major differences that I have vs. you features are:- I don't currently expose a progress callbackI assumed that the ‘Task’ object, returned from your public method that starts the download, includes a way for the app to monitor progress. (There’s a similar Cocoa class called NSProgress which I’m thinking of using.) I’m not familiar with the .NET frameworks and I assume it’s a standard class?
- I do combine requests that would pull the same object based on the digest (so only one network request would be made)Yup, I’ll be adding that.- I throttle the number of simultaneous network requests to 4 (configurable), so that the network does not get choked with too many requests at once.The Cocoa network framework already takes care of that; like a browser, it will open a limited number of sockets to a single host, and queues requests onto those sockets.- I created a new replication "AttachmentPuller" to do this work instead of adding to the current Puller.I didn’t see a need to change the public API to do this. The app should be able to use the same Replication it already uses to pull docs. It’s fine to use a new puller object internally, but that should be just an implementation detail.
On Aug 10, 2015, at 6:11 PM, Brett Harrison <brett.h...@zyamusic.com> wrote:
The Task object is basically a Job for a thread pool. If I convert to your API, it would be removed.
I plan to have the attachment puller point at a different URL that is a CDN (the CDN will pull from the original sync gateway as needed).
On Aug 10, 2015, at 6:11 PM, Brett Harrison <brett.h...@zyamusic.com> wrote:
The Task object is basically a Job for a thread pool. If I convert to your API, it would be removed.
Not exactly sure what that means, but anyway it’s not required that we do this identically — the API spec assumes things like notifications, async calls or delegation will work differently between platforms.
I’ve now decided that in Cocoa it would be better to have the download method return an NSProgress object. This is more standardized and allows the caller to cancel or pause the download. (It will make observing progress a bit more complicated for the caller, though.)
I plan to have the attachment puller point at a different URL that is a CDN (the CDN will pull from the original sync gateway as needed).
Hm. That relates to another open issue, #78, although only on the downloading side. I take it you’d be uploading attachments to Sync Gateway as usual, just the downloads would be routed through the CDN?