Couchbase Lite C
Couchbase Lite C API
|
These functions implement a fairly-efficient "delta" encoding that encapsulates the changes needed to transform one Fleece value into another. More...
Functions | |
FLSliceResult | FLCreateJSONDelta (FLValue old, FLValue nuu) |
Returns JSON that encodes the changes to turn the value old into nuu . More... | |
bool | FLEncodeJSONDelta (FLValue old, FLValue nuu, FLEncoder jsonEncoder) |
Writes JSON that describes the changes to turn the value old into nuu . More... | |
FLSliceResult | FLApplyJSONDelta (FLValue old, FLSlice jsonDelta, FLError *error) |
Applies the JSON data created by CreateJSONDelta to the value old , which must be equal to the old value originally passed to FLCreateJSONDelta , and returns a Fleece document equal to the original nuu value. More... | |
bool | FLEncodeApplyingJSONDelta (FLValue old, FLSlice jsonDelta, FLEncoder encoder) |
Applies the (parsed) JSON data created by CreateJSONDelta to the value old , which must be equal to the old value originally passed to FLCreateJSONDelta , and writes the corresponding nuu value to the encoder. More... | |
These functions implement a fairly-efficient "delta" encoding that encapsulates the changes needed to transform one Fleece value into another.
The delta is expressed in JSON form.
A delta can be stored or transmitted as an efficient way to produce the second value, when the first is already present. Deltas are frequently used in version-control systems and efficient network protocols.
FLSliceResult FLApplyJSONDelta | ( | FLValue | old, |
FLSlice | jsonDelta, | ||
FLError * | error | ||
) |
Applies the JSON data created by CreateJSONDelta
to the value old
, which must be equal to the old
value originally passed to FLCreateJSONDelta
, and returns a Fleece document equal to the original nuu
value.
old | A value that's typically the old/original state of some data. This must be equal to the old value used when creating the jsonDelta . |
jsonDelta | A JSON-encoded delta created by FLCreateJSONDelta or FLEncodeJSONDelta . |
error | On failure, error information will be stored where this points, if non-null. |
nuu
value, encoded as Fleece, or null if an error occurred. FLSliceResult FLCreateJSONDelta | ( | FLValue | old, |
FLValue | nuu | ||
) |
Returns JSON that encodes the changes to turn the value old
into nuu
.
(The format is documented in Fleece.md, but you should treat it as a black box.)
old | A value that's typically the old/original state of some data. |
nuu | A value that's typically the new/changed state of the old data. |
old
to nuu
, or NULL on (extremely unlikely) failure. Applies the (parsed) JSON data created by CreateJSONDelta
to the value old
, which must be equal to the old
value originally passed to FLCreateJSONDelta
, and writes the corresponding nuu
value to the encoder.
old | A value that's typically the old/original state of some data. This must be equal to the old value used when creating the jsonDelta . |
jsonDelta | A JSON-encoded delta created by FLCreateJSONDelta or FLEncodeJSONDelta . |
encoder | A Fleece encoder to write the decoded nuu value to. (JSON encoding is not supported.) |
FLEncoder_GetError
for details. Writes JSON that describes the changes to turn the value old
into nuu
.
(The format is documented in Fleece.md, but you should treat it as a black box.)
old | A value that's typically the old/original state of some data. |
nuu | A value that's typically the new/changed state of the old data. |
jsonEncoder | An encoder to write the JSON to. Must have been created using FLEncoder_NewWithOptions , with JSON or JSON5 format. |