Closed heartsentwined closed 10 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.
Thanks for the clarification!
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
, andtype
. What is the purpose and expected server treatment of these? In particular,clientId
andclientRev
?As far as I know,
id
- we all know what this doestype
- identifies the model class, although #32 does mention moving this to_type
clientId
- this is sent to the server for newly created records, as a temporary identifier. The server is expected to echo this back in the response payload, so thatepf
can map the returned record(s) to the corresponding client records.clientRev
- this is sent to the server too, but that's all I knowrev
- ?