PFS2

Revision as of 01:07, 12 March 2009 by Aking (talk | contribs) (→‎Q&A: Throwing the Post to create query results pattern out there)

Request

Current PFS parameters

mimetype=application/x-java-appletapp
ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
appVersion=1.5.0.4
clientOS=Win
chromeLocale=en-US

Current VersionCheck parameters:

reqVersion=1
id={49f3fc85-dcfe-4e42-9301-226ebe658509}
version=0.6.1
maxAppVersion=2.0.0.*
status=userEnabled,incompatible
appID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
appVersion=3.0b3pre
appOS=Darwin
appABI=x86-gcc3
locale=en-US

Response

Is the following data a sample of the JSON output of PFS2?

[ {
  "name" : "Plugin",
  "version" : "1.0",
  "filename" : "plugin.dll",
  "vendor" : "Mozilla",
  "url" : "http://mozilla.com/",
  "icon_url" : "http://mozilla.com/favicon.ico",
  "latest_version" : "1.0",
  "installer_location" : "http://mozilla.com/installer.exe",
  "installer_hash" : "sha256:592eca7e6f2731c65e344c4514bd7efa0a7ec8a203d97b4f5aadb14c44379178",
  "installer_shows_ui" : "false",
  "license_url" : "http://mozilla.com/license.html",
  "needs_restart" : "true",
  "description" : "This is a Mozilla plugin that does things.",
  "platforms" : [
    { "name" : "Mac OSX" },
    { "name" : "Windows NT 6.0" } 
  ], 
  "xpcomabi" : "x86",
  "mime_types" : [ { 
    "mime" : "text/plain",
    "description" : "HTML",
    "suffixes" : ".html, .xhtml, .htm"
  } ]
} ]

Q&A

  • What is the API for a request in PFS2?
    • Will add this to the "request" section but it will look a lot like a cross between the extension update service and the URLs used for PFS currently
  • Is it a GET with query string like PFS, or is it a POST with a JSON encoded body (like one below with less info)?
    • I think it's pretty easy to handle either case, but since we'd potentially be dealing with arrays of plugins I'd opt to accept a JSON body and have the app run logic on it.
    • One argument against using POST is that doing so doesn't give you a good cache hit rate and could possibly crush the service doing operations that otherwise could be easily cached (albeit with an increase in HTTP requests).
    • A Post to create query pattern might resolve cache issues
  • Will there be a batch request mode, or 1 request per plugin?
    • Leaning towards 1 request per plugin at this point, but we should take some time to figure out which solution is best.

Post to create query results pattern

  1. client POSTs JSON body server
  2. server hashes the request parameters and stores work request in queue or db
  3. server redirects request to the location which contins contains the actual results
  4. client GETs results url
  5. cache miss, retrieve work or results from queue or db by hash
  6. subsequent requests hit cache

Related: http://en.wikipedia.org/wiki/Post/Redirect/Get