Changes

Jump to: navigation, search

Sauropod

1,270 bytes added, 18:07, 7 November 2011
OpenWebApps
The first use case for Sauropod is to store a user's list of installed "apps" for the OpenWebApps projects. This use-case has the following requirements (all operations are per-user):
#Add an installed appThe code that appsync is using is located in [https://github.com/mozilla/appsync/blob/master/appsync/storage/sql.py appsync/storage/sql.py] (the <tt>SQLDatabase</tt> object) - the basic API it uses is given. Apps It uses a few standard objects: ; <tt>user</tt> : the username (could/should also be inferred by the authentication we used); <tt>collection</tt> : a string we use to identify different kinds of objects (will generally be <tt>"apps"</tt>, but we might want to store the list of clients in a different collection); timestamps : are keyed by domainintegers (hundredths of a second from the epoc). And there are these routines: ; <tt>storage.delete(user, collection, client_id, reason="")</tt> : deletes everything in the collection and leaves behind a stub that says who (<tt>client_id</tt>) deleted the collection and optionally why (<tt>reason</tt>). Implemented in SQL with a table of deleted collections (values are uniquea JSON serialization of the client_id and reason). ; <tt>storage.get_applications(user, collection, since=0)</tt> : returns all the applications (JSON objects really) that have been updated since <tt>since</tt>. The value of an app record <tt>since</tt> time is an arbritrary JSON object''our local timestamp'', not something from the client's time. ; <tt>storage.add_applications(user, collection, applications)<br/tt> #Retrieve : adds all the applications; <tt>applications</tt> is a list of all installed apps, returns an array of app recordsJSONable objects/dicts. Our storage knows that <tt>application['origin']<br/tt> #Modify an app recordmust be unique, and so can delete old applications; Sauropod itself would presumably not know this. Though this doesn't return a timestamp, disallow deleting an app probably it should/could (a user never unpurchases an app but may choose something to uninstall it which is denoted by marking it as such in the app recordmatch with <tt>since</tt>). ----
In addition, there are a few use-cases for aggregate data, not per-user.&nbsp;Ideally this aggregation would be done by the Sauropod on the server side.
Confirm
176
edits

Navigation menu