Interface IRecordV2Delta
The IRecordV2 structural delta.
Namespace: PushTechnology.ClientInterface.Data.Record
Assembly: Diffusion.Client.dll
Syntax
public interface IRecordV2Delta
Remarks
A IRecordV2Delta describes the differences between two IRecordV2 values. Unlike a IBinaryDelta, a structural delta can be queried to determine its effect. The Changes(ISchema) method provides details of which values have changed.
An instance can be created from two IRecordV2 values using Diff(IRecordV2).
Implemented in Version 6.0.
Examples
RecordV2Deltas are useful for identifying small changes to complex RecordV2 values. Here's an example of how to use this class to filter interesting changes in a ValueStream.
public class ExampleStream : IValueStream<IRecordV2> {
public void OnValue( string topicPath, ITopicSpecification specification, IRecordV2 oldValue, IRecordV2 newValue ) {
var delta = newValue.Diff( oldValue );
foreach ( var change in delta.Changes( schema ) ) {
if ( change.FieldName == "address" ) {
ProcessAddress( newValue );
}
}
// ...
}
// ...
}
Methods
Changes(ISchema)
Returns a list of the changes represented by the delta with reference to a specified schema.
Declaration
IReadOnlyList<IChange> Changes(ISchema schema)
Parameters
Type | Name | Description |
---|---|---|
ISchema | schema | The schema. |
Returns
Type | Description |
---|---|
IReadOnlyList<IChange> | The immutable list of changes. |
Remarks
The schema supplied must comply with the data format of the delta. No validation takes place, so if the schema does not match the data then the results may be unpredictable.