Diffusion .NET Client Library
6.1.5
|
The optional extension provided by IDataType implementations that support incremental changes to values. More...
Public Member Functions | |
void | WriteDelta (TDelta delta, Stream outputStream) |
Serializes a delta to binary. More... | |
IBytes | ToBytes (TDelta delta) |
Returns the serialized form of the given delta as IBytes. More... | |
new TDelta | ReadDelta (byte[] input, int offset, int length) |
Parse a delta from binary segment. More... | |
new TDelta | ReadDelta (byte[] input) |
Parse a delta from binary. More... | |
new TDelta | ReadDelta (IBytes input) |
Creates a delta from IBytes. More... | |
TDelta | Diff (TValue oldValue, TValue newValue) |
Creates a delta from two values. More... | |
TValue | Apply (TValue oldValue, TDelta delta) |
Applies a delta to a value. More... | |
bool | IsValueCheaper (TValue value, TDelta delta) |
Calculates if value is cheaper than delta . The result is typically determined by the length of the serialized form but can also consider the complexity of the delta. More... | |
Public Member Functions inherited from PushTechnology.ClientInterface.Data.IDeltaType | |
void | WriteDelta (object delta, Stream outputStream) |
Serializes a delta to binary. More... | |
IBytes | ToBytes (object delta) |
Returns the serialized form of the given delta as IBytes. More... | |
object | Diff (object oldValue, object newValue) |
Creates a delta from two values. More... | |
object | Apply (object oldValue, object delta) |
Applies a delta to a value. More... | |
bool | IsValueCheaper (object value, object delta) |
Calculates if value is cheaper than delta . The result is typically determined by the length of the serialized form but can also consider the complexity of the delta. More... | |
Properties | |
new TDelta | NoChange [get] |
Returns a constant that indicates no changes between values. More... | |
Properties inherited from PushTechnology.ClientInterface.Data.IDeltaType | |
string | Name [get] |
Returns the external identifier for this delta type. More... | |
object | NoChange [get] |
Returns a constant that indicates no changes between values. More... | |
The optional extension provided by IDataType implementations that support incremental changes to values.
This is a generic version of the IDeltaType interface that provides overloads for all object methods. It instead provides typed arguments and return values based on the given value and delta type.
For more information about the delta type interface, see
.
Since 5.8
TValue PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.Apply | ( | TValue | oldValue, |
TDelta | delta | ||
) |
Applies a delta to a value.
oldValue | The old value. |
delta | The delta to apply to the old value. |
TDelta PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.Diff | ( | TValue | oldValue, |
TValue | newValue | ||
) |
Creates 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 IsValueCheaper(TValue,TDelta).
The implementation can return the special constant NoChange to indicate the oldValue and newValue are equivalent and there is no change to publish.
oldValue | The old value. |
newValue | The new value. |
bool PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.IsValueCheaper | ( | TValue | value, |
TDelta | delta | ||
) |
Calculates if value is cheaper than delta . The result is typically determined by the length of the serialized form but can also consider the complexity of the delta.
value | The value. |
delta | The delta. |
new TDelta PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.ReadDelta | ( | byte[] | input, |
int | offset, | ||
int | length | ||
) |
Parse a delta from binary segment.
input | The binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified. |
offset | The starting index of the segment. |
length | The length of the segment. |
Implements PushTechnology.ClientInterface.Data.IDeltaType.
new TDelta PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.ReadDelta | ( | byte[] | input | ) |
Parse a delta from binary.
This is equivalent to ReadDelta(input,0,input.Length).
input | The binary data. The implementation may re-use the array to avoid copying. The caller must ensure the array is not modified. |
Implements PushTechnology.ClientInterface.Data.IDeltaType.
new TDelta PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.ReadDelta | ( | IBytes | input | ) |
Creates a delta from IBytes.
This is equivalent to calling ReadDelta(byte[]) with the result of IBytes.ToByteArray as argument.
Since 6.0.
input | The binary data. |
Implements PushTechnology.ClientInterface.Data.IDeltaType.
IBytes PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.ToBytes | ( | TDelta | delta | ) |
void PushTechnology.ClientInterface.Data.IDeltaType< TValue, TDelta >.WriteDelta | ( | TDelta | delta, |
Stream | outputStream | ||
) |
Serializes a delta to binary.
delta | The delta. |
outputStream | The output stream. |
|
get |
Returns a constant that indicates no changes between values.
This constant is returned by Diff(TValue,TValue) to indicate oldValue and newValue are equivalent. The result is guaranteed to be equal only to itself.