the value type of the data type
the type(s) from which a value can be constructed
the binary type containing the CBOR data
Apply a delta to a value.
the delta to apply
the new value generated applying the delta to the old value
Create a delta from two values.
If there are many differences between oldValue and newValue, the result might require more bytes to transmit than the new value, or be computationally expensive to apply. In this case, it is better to discard oldValue and publish newValue in its place. This can be checked using DeltaType.isValueCheaper.
The implementation can return the special constant DeltaType.noChange to indicate the old value and new value are equivalent and there is no change to publish.
the old value
the new value
the delta between values
Calculate if value
is cheaper than the delta
. The
result is typically determined by the length of the serialised form, but may
also consider the complexity of the delta.
the value to compare
the delta to compare
true
if the value is considered cheaper than the delta
The name of this delta type
the name
Constant returned by DeltaType.diff to indicate that both values are equivalent.
unique object representing no change in value
Parse a delta from binary.
the offset from which to start reading from the buffer
the length of data to read from the buffer
the delta
Serialise a delta to binary.
the delta to serialise
the serialised form of the delta
Serialise a delta to binary.
the delta to serialise
the serialised form of the delta
Optional extension provided by DataType implementations that support incremental changes to values.
A data type can optionally support incremental changes to values, represented by one or more types of delta. A delta is the difference between two values. For large or composite values that change in small steps, it is more efficient to transmit an initial value followed by a delta for each change than to transmit a complete value for each change.
Each implementation specifies a
value
type and adelta
type. Two values, oldValue and new Value, can be compared to produce a delta using DeltaType.diff. The delta can be separately applied to oldValue to create newValue using DeltaType.apply.Deferred parsing
Implementations can choose not to fully validate values when they are read, but instead defer parsing until it is required. Consequently, all methods that accept values may throw an error.5.7