On Wed, Jan 22, 2014 at 12:04 PM, Andrea Marchesini <
ba...@mozilla.com> wrote:
> Here a full proposal for DataStore + transaction semantics:
>
> interface DataStore : EventTarget {
> ...
>
> // Get returns a single DataStoreRecord object or an array of them.
> // Promise<any>
> Promise get(DataStoreKey... id);
>
> // Promise<void>
> Promise put(any obj, DataStoreKey id, optional DOMString revisionId);
>
> // Promise<DataStoreKey>
> Promise add(any obj, optional DataStoreKey id,
> optional DOMString revisionId);
>
> // Promise<boolean>
> Promise remove(DataStoreKey id, optional DOMString revisionId);
>
> ...
> };
>
> // This dictionary is the return value of the get() method.
> dictionary DataStoreRecord {
> DOMString revisionId;
> DataStoreKey id;
> any value;
> };
>
> put(), add() and remove() have an optional param for the revisionId.
> If it's not null, the operation is completed only if the current revision of the object is equal to what has been passed as argument.