Confirmed users
53
edits
No edit summary |
|||
Line 11: | Line 11: | ||
Support read/write stores like built-in contacts.<br> | 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> | 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> | ||
== Why not...? == | == Why not...? == | ||
Line 64: | Line 63: | ||
== Interface == | == Interface == | ||
interface DataStore { | interface DataStore : EventTarget { | ||
// Returns the label of the DataSource. | // Returns the label of the DataSource. | ||
readonly attribute DOMString name; | readonly attribute DOMString name; | ||
Line 84: | Line 83: | ||
attribute EventHandler onchange; | attribute EventHandler onchange; | ||
Promise<DataStoreChanges> getChanges(DOMString revisionId); | |||
// TODO: getAll(), getLength(). | // TODO: getAll(), getLength(). | ||
Line 126: | Line 125: | ||
} | } | ||
== | == Revisions and changes == | ||
The revisionId is a UUID and it can be used to retrieve the delta between a particular revisionId and the current one. This operation is done using |Promise<DataStoreChanges> getChanges(DOMString revisionId);|. Note that the object DataStoreChanges contains only useful operations: for example, the ID of record that has been updated and removed only shows up in the |removedIds| array. | |||
== Issues == | == Issues == | ||
Line 173: | Line 133: | ||
* UI: what to do when we have multiple access requests? | * UI: what to do when we have multiple access requests? | ||
* What's happening if the central gets changes during the process of local updates? | * What's happening if the central gets changes during the process of local updates? | ||
* Should all data stores with the same name share a schema? | * 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? | * Enforcing types can be a footgun. What should a data provider do if it decides some key should have a different type? |