Show / Hide Table of Contents

Interface IEvolvable

The IEvolvable interface is implemented by types that require forwards- and backwards-compatibility of their serialized form.

Namespace: Tangosol.IO
Assembly: Coherence.dll
Syntax
public interface IEvolvable
Remarks

An IEvolvable class has an integer version identifier n, where n >= 0. When the contents and/or semantics of the serialized form of the IEvolvable class changes, the version identifier is increased. Two versions identifiers, n1 and n2, indicate the same version if n1 == n2; the version indicated by n2 is newer than the version indicated by n1 if n2 > n1.

The IEvolvable interface is designed to support the evolution of types by the addition of data. Removal of data cannot be safely accomplished as long as a previous version of the type exists that relies on that data. Modifications to the structure or semantics of data from previous versions likewise cannot be safely accomplished as long as a previous version of the type exists that relies on the previous structure or semantics of the data.

When an IEvolvable object is deserialized, it retains any unknown data that has been added to newer versions of the type, and the version identifier for that data format. When the IEvolvable object is subsequently serialized, it includes both that version identifier and the unknown future data.

When an IEvolvable object is deserialized from a data stream whose version identifier indicates an older version, it must default and/or calculate the values for any data fields and properties that have been added since that older version. When the IEvolvable object is subsequently serialized, it includes its own version identifier and all of its data. Note that there will be no unknown future data in this case; future data can only exist when the version of the data stream is newer than the version of the IEvolvable type.

Properties

DataVersion

Gets or sets the version associated with the data stream from which this object was deserialized.

Declaration
int DataVersion { get; set; }
Property Value
Type Description
int

The version of the data used to initialize this object, greater than or equal to zero.

Remarks

If the object was constructed (not deserialized), the data version is the same as the implementation version.

Exceptions
Type Condition
ArgumentException

If the specified version is negative.

InvalidOperationException

If the object is not in a state in which the version can be set, for example outside of deserialization.

FutureData

Gets or sets all the unknown remainder of the data stream from which this object was deserialized.

Declaration
Binary FutureData { get; set; }
Property Value
Type Description
Binary

Future data in binary form.

Remarks

The remainder is unknown because it is data that was originally written by a future version of this object's type.

Exceptions
Type Condition
InvalidOperationException

If the object is not in a state in which the version can be set, for example outside of deserialization.

ImplVersion

Determine the serialization version supported by the implementing type.

Declaration
int ImplVersion { get; }
Property Value
Type Description
int

The serialization version supported by this object.

In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.