Changes

Jump to: navigation, search

WebAPI/DataStore

1,305 bytes removed, 13:44, 23 August 2013
no edit summary
Support read/write stores like built-in contacts.<br>
Support keeping an application-local cache of a data store. I.e. enable getting notified about changes to a data store so that the local cache can be kept up-to-date.<br>
Enforce types of attributes (avoid to break other applications).
== Why not...? ==
== Interface ==
interface DataStore : EventTarget {
// Returns the label of the DataSource.
readonly attribute DOMString name;
attribute EventHandler onchange;
FuturePromise<DataStoreChanges> getChanges(DOMString revisionId);
// TODO: getAll(), getLength().
}
== Incremental Schema Revisions and changes ==DataStore is designed for sharing data among applications. Applications will make some assumptions on data types of attributes. If the data type of an attributes is not consistent among applications, applications may be broken. So, data types of attributes should be enforced.to define types of an attributes while attributes with a new path were found first time. In another word, once a new object was added to a data store, its tree of attributes will be traveled, and define the type of new found attributes with the type of their values.
For example, if the following object The revisionId is a UUID and it can be used to retrieve the object been added to delta between a data storeparticular revisionId and the current one { SN: 123, name: "John Lin", info: { address: ".....", birth: DateThis operation is done using |Promise<DataStoreChanges> getChanges(DOMString revisionId);|....), } } Then, the types table of Note that the data store is SN: Integer name: String info: object info addressDataStoreChanges contains only useful operations: String info birth: Date Thenfor example, the following object is added. { SN: 123, name: "John Lin", info: { address: ".....", birth: Date(....), phone: "123456", } } The types table should be SN: Integer name: String info: object info address: String info birth: Date info phone: String Every time a new object was added to a data store, the types ID of attributes would be checked against the types table of the data store. The action of adding will be failed if the type of any attribute does not match the type defined record that has been updated and removed only shows up in the types table|removedIds| array.
== Issues ==
* UI: what to do when we have multiple access requests?
* What's happening if the central gets changes during the process of local updates?
* |addedIds|, |removedIds| and |updatedIds| arrays should be synchronized. For example, the ID of record that has been updated and removed should only show up in the |removedIds| array. Need to define the behaviours.
* Should all data stores with the same name share a schema?
* Enforcing types can be a footgun. What should a data provider do if it decides some key should have a different type?
Confirm
53
edits

Navigation menu