mozilla / apk-factory-service

Web service which converts Open Web Apps into native Android apps
42 stars 18 forks source link

Implement OWA Downloading algorithm #15

Closed ozten closed 10 years ago

ozten commented 10 years ago

We should build a server side version of the algorithm that is in Fennec for deciding if an OWA Version has changed.

Assigning to @mykmelez to document via comments in this bug (or wherever).

mykmelez commented 10 years ago

The algorithm lives in the very large function checkForUpdate. It looks something like this:

Up until the appcache check, the algorithm seems fairly straightforward. But the appcache check is implemented in a different part of the codebase and seems complex. So I'm leery of duplicating its algorithm on the server, although I'm unsure what the alternatives are. This part needs more research.

ozten commented 10 years ago

Awesome, thanks!

ozten commented 10 years ago

otherwise, if the app is a hosted app, and it has an appcache_path property, check for an appcache update

also...

otherwise, if the app is a packaged app, resolve package_path and check to see if the hash of the package has changed.

Save hash of package with the has of the manifest.

(right?)

mykmelez commented 10 years ago

otherwise, if the app is a packaged app, resolve package_path and check to see if the hash of the package has changed.

I thought we were doing this, but then I didn't see it when I read the algorithm. But I might have missed it.

ozten commented 10 years ago

Design: Issue #13 creates the APK Metadata. Issue#18 integrates with S3. Each controller deamon will make requests with the OWA Downloader and then check it's results (using the above algorithm) against the APK Metadata. If it is a cache hit, it will get the APK out of S3.

The OWA Downloader will use either the modified module or a Squid reverse proxy to optimize the requests.

mykmelez commented 10 years ago

After thinking about it more, I think we shouldn't try to support appcache-based updates. At least not in the initial implementation (nor, for that matter, should we try to pre-cache the appcache and include it in the APK). It's too likely to be a rat hole, given the complexity of the API. And would only help a small portion of apps in any case. Let's focus on the majority cases.

ozten commented 10 years ago

Filed Issue #29. Assuming we deploy with Squid, everything else is this bug is finished. Closing.