Confirmed users
398
edits
(Created page with "= Data Store API = This is the snapshot of a discussion between Mounir Lamouri, Thinker Lee, Gene Lian, Jonas Sicking and Hsin-Yi Tsai.<br> The work drafting happened on http...") |
No edit summary |
||
| Line 71: | Line 71: | ||
... | ... | ||
} | } | ||
== Incremental Schema == | |||
DataStore is designed for sharing data among applications. Applications will assume data types of attributes of objects in a data store. If the data type of an attributes is not consistent among applications, applications will be broken for read data from other applications with different assumption on the data type. That is why the data types of attributes should be enforced. | |||
Every object in a data store is a tree. The path from root to any node can be represented as an ordered list of attribute names. Incremental schema is to define the type of an attribute while the path of the attribute was found first time. In an other word, once a new object was added to a data store, its tree of attributes will be traveled, and assigned the type of new attributes as the type of their values. A new attribute is one attribute whose path from root is never found before in a data store. | |||
For example, if the following object is the object been added to a data store. | |||
{ | |||
SN: 123, | |||
name: "John Lin", | |||
info: { | |||
address: ".....", | |||
birth: Date(....), | |||
} | |||
} | |||
Then, the table of types of attributes should be | |||
SN: Integer | |||
name: String | |||
info: object | |||
info address: String | |||
info birth: Date | |||
Then, the following object is added. | |||
{ | |||
SN: 123, | |||
name: "John Lin", | |||
info: { | |||
address: ".....", | |||
birth: Date(....), | |||
phone: "123456", | |||
} | |||
} | |||
The table of types of attributes 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 of attributes of the object 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 in the types table. | |||
== Issues == | == Issues == | ||
| Line 77: | Line 121: | ||
* 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? | ||
* |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. | * |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 name share a schema? | |||