共用方式為


Epoch Class

  • java.lang.Object
    • Serializable
      • system.fabric.Epoch

public class Epoch

Represents the current version of the partition in Service Fabric.

Remarks:An Epoch is a configuration number for the partition as a whole. When the configuration of the replica set changes, for example when the Primary replica changes, the operations that are replicated from the new Primary replica are said to be a new Epoch from the ones which were sent by the old Primary replica. The fact that the Primary has changed is not directly visible to Secondary replicas, which are usually unaffected by the failure that affected the original Primary replica. To track that the Primary replica has changed has to be communicated to the Secondary replica. This communication occurs via the updateEpochAsync(Epoch epoch, SequenceNumber previousEpochLastSequenceNumber, CancellationToken cancellationToken) method. Most services can ignore the details of the inner fields of the Epoch as it is usually sufficient to know that the Epoch has changed and to compare Epochs to determine relative ordering of operations and events in the system. Comparison operations are provided for this purpose.

Constructor Summary

Constructor Description
Epoch(long dataLossNumber, long configurationNumber)

Initializes a new instance of the system.fabric.Epoch class with the specified data loss number and configuration number.

Method Summary

Modifier and Type Method and Description
int compareTo(Epoch other)

Compares two system.fabric.Epoch objects.

boolean equals(Object obj)

Compares the current system.fabric.Epoch object with the passed system.fabric.Epoch object.

long getConfigurationNumber()

Gets the current configuration number property in this system.fabric.Epoch.

Remarks:The configuration number is an increasing value that is updated whenever the configuration of this replica set changes. The services are informed of the current configuration number only when updateEpochAsync(Epoch epoch, CancellationToken cancellationToken) method is called as a result of an attempt to change the Primary replica of the replica set.

long getDataLossNumber()

Gets the current data loss number in this system.fabric.Epoch.

Remarks:The data loss number property is an increasing value which is updated whenever data loss is suspected, as when loss of a quorum of replicas in the replica set that includes the Primary replica.

int hashCode()

Gets the hashCode of the system.fabric.Epoch object.

void setConfigurationNumber(long configurationNumber)

Sets the current configuration number property in this system.fabric.Epoch.

Remarks:The configuration number is an increasing value that is updated whenever the configuration of this replica set changes. The services are informed of the current configuration number only when updateEpochAsync(Epoch epoch, CancellationToken cancellationToken) method is called as a result of an attempt to change the Primary replica of the replica set.

void setDataLossNumber(long dataLossNumber)

Sets the current data loss number in this system.fabric.Epoch.

Remarks:The data loss number property is a monotonically increasing value which is updated whenever data loss is suspected, as when loss of a quorum of replicas in the replica set that includes the Primary replica.

Constructor Details

Epoch

public Epoch(long dataLossNumber, long configurationNumber)

Initializes a new instance of the system.fabric.Epoch class with the specified data loss number and configuration number.

Parameters:

dataLossNumber - A long representing an increasing value which is updated whenever data loss is suspected.
configurationNumber - A long representing an increasing value that is updated whenever the configuration of this replica set changes.

Method Details

compareTo

public int compareTo(Epoch other)

Compares two system.fabric.Epoch objects.

Parameters:

other - another system.fabric.Epoch object.

Returns:

0, if they are equal, -1 if first is less than other. 1 if fist is greater that passed system.fabric.Epoch object.

equals

public boolean equals(Object obj)

Compares the current system.fabric.Epoch object with the passed system.fabric.Epoch object.

Parameters:

obj -

system.fabric.Epoch object.

Returns:

boolean value: true, if they are equal. false otherwise.

getConfigurationNumber

public long getConfigurationNumber()

Gets the current configuration number property in this system.fabric.Epoch.

Remarks:The configuration number is an increasing value that is updated whenever the configuration of this replica set changes. The services are informed of the current configuration number only when updateEpochAsync(Epoch epoch, CancellationToken cancellationToken) method is called as a result of an attempt to change the Primary replica of the replica set.

Returns:

A long representing the configuration number.

getDataLossNumber

public long getDataLossNumber()

Gets the current data loss number in this system.fabric.Epoch.

Remarks:The data loss number property is an increasing value which is updated whenever data loss is suspected, as when loss of a quorum of replicas in the replica set that includes the Primary replica.

Returns:

A long representing the current data loss number.

hashCode

public int hashCode()

Gets the hashCode of the system.fabric.Epoch object.

Returns:

integer value representing hashCode of the system.fabric.Epoch object.

setConfigurationNumber

public void setConfigurationNumber(long configurationNumber)

Sets the current configuration number property in this system.fabric.Epoch.

Remarks:The configuration number is an increasing value that is updated whenever the configuration of this replica set changes. The services are informed of the current configuration number only when updateEpochAsync(Epoch epoch, CancellationToken cancellationToken) method is called as a result of an attempt to change the Primary replica of the replica set.

Parameters:

configurationNumber - A long representing the configuration number.

setDataLossNumber

public void setDataLossNumber(long dataLossNumber)

Sets the current data loss number in this system.fabric.Epoch.

Remarks:The data loss number property is a monotonically increasing value which is updated whenever data loss is suspected, as when loss of a quorum of replicas in the replica set that includes the Primary replica.

Parameters:

dataLossNumber - A long representing the current data loss number.

Applies to