When data is cached, delta is calculated that is a difference between two resource data versions that allows a mobile device to restore a new resource version from the saved older version.
To designate delta between two resource data versions, use transformation of the initial data version to the final one.
When delta is requested, initial and final versions are specified:
Version numbering started from zero. A zero version means that resource data has not been yet loaded.
After the first loading resource data gets the 1 version even if it is empty.
Each next loading increases the version number by one even if resource data is not changed.
To update data to the latest version on a mobile device, specify the "last" word in the request as the number of the final version of resource data.
The delta version can be marked with the "auto" keyword, which means that data version is calculated by the ETag parameter in the request.
Below is the syntax of delta versions according to the ABNF notation:
delta_versions = old "-" new
old = "v" version_number
new = ("v" version_number) / "last"
version_number = 1 * DIGIT
The example of correct versions: v0-last, v2-last, v1-v3, v2-v2.
The example of incorrect versions: v2-v1, v0-v0, v1-v0.
NOTE. Delta is meaningless if the final version is zero or less than the initial one, for example, the v2-last record is incorrect if the final version is 1.
A request can be executed synchronously in the same execution stream and asynchronously in a new execution stream. If the request is synchronous, the result is obtained right after request execution. If the request is asynchronous, first, the request is prepared, and the callback function is used that is called by the system after the request result is obtained. The request result is sent to the function as an argument.
The execution time for various API requests depends on quick and long methods. Main features of quick method execution:
The method is executed in UI stream.
The request is executed only synchronously.
Request execution result is returned by the method.
See also: