getoutreach / epf

A framework for keeping your Ember.js apps in sync.
http://epf.io
MIT License
369 stars 33 forks source link

Purpose and expectation for reserved keywords #89

Closed heartsentwined closed 10 years ago

heartsentwined commented 11 years ago

This is a question. But I'm putting it here so that future devs can find it.

32 gives a list of reserved model attributes / properties: rev, id, clientId, clientRev, and type. What is the purpose and expected server treatment of these? In particular, clientId and clientRev?

As far as I know,

ghempton commented 11 years ago

rev and clientRev are optional. They basically function as a vector clock and are used to handle complex merge scenarios.

In a nutshell, rev is used by the client to know if it should merge the data and treat it as new data. You could imagine (depending on the backend) a scenario where the client has already seen newer data than what gets sent from the server. Similarly, clientRev can either be used by the server–if the backend supported merging– or just passed through to the client. The client can use clientRev to determine the common ancestor revision for merging.

As I said before, they are optional. If there is no rev property then the client assumes that the data is newer than any data it has seen before. If there is no clientRev property, then the client assumes that the data has not seen the latest client changes.

heartsentwined commented 10 years ago

Thanks for the clarification!