你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Epoch Class
- java.
lang. Object - Serializable
- system.
fabric. Epoch
- system.
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:
Method Details
compareTo
public int compareTo(Epoch other)
Compares two system.fabric.Epoch objects.
Parameters:
Returns:
equals
public boolean equals(Object obj)
Compares the current system.fabric.Epoch object with the passed system.fabric.Epoch object.
Parameters:
system.fabric.Epoch object.
Returns:
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:
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:
hashCode
public int hashCode()
Gets the hashCode of the system.fabric.Epoch object.
Returns:
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:
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: