Class CsnGenerator
java.lang.Object
org.opends.server.replication.common.CsnGenerator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceGenerate a sequence number for a stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdjust the lastTime of thisCsnGeneratorwith aCsnthat we have received from another server.voidadjust(ServerState state) Adjust utility method that takes ServerState as a parameter.Returns the generatedCsn.generateCsnV3(long streamTimeStamp, long curTime, CsnGenerator.StreamSequenceNumberGenerator streamSeqNumGen) Generate a newCsnusing the V3 format.static booleanisSequenceBroken(Csn csn1, Csn csn2) Checks whether the sequence is broken between twoCsns.static CsnGeneratornewCsnGenerator(ReplicaId replicaId, long timestamp) Create a newCsnGenerator.static CsnGeneratornewCsnGenerator(ReplicaId replicaId, LongSupplier timeSupplier) Create a newCsnGenerator.Returns a newCsnGenerator.StreamSequenceNumberGenerator.static longnextStreamSeqNum(long streamSeqNum) Returns the next stream sequence number.
-
Method Details
-
newCsnGenerator
Create a newCsnGenerator.- Parameters:
replicaId- id to use when creatingCsns.timestamp- time to start with.- Returns:
- the new
CsnGenerator
-
newCsnGenerator
Create a newCsnGenerator.- Parameters:
replicaId- the replicaId to use when creatingCsnstimeSupplier- the timestamp supplier- Returns:
- the new
CsnGenerator
-
newStreamSequenceNumberGenerator
Returns a newCsnGenerator.StreamSequenceNumberGenerator.- Returns:
- a new
CsnGenerator.StreamSequenceNumberGenerator
-
generateCsn
-
generateCsnV3
public Csn generateCsnV3(long streamTimeStamp, long curTime, CsnGenerator.StreamSequenceNumberGenerator streamSeqNumGen) Generate a newCsnusing the V3 format. -
nextStreamSeqNum
public static long nextStreamSeqNum(long streamSeqNum) Returns the next stream sequence number.- Parameters:
streamSeqNum- the current stream sequence number- Returns:
- the next stream sequence number
-
isSequenceBroken
-
adjust
Adjust utility method that takes ServerState as a parameter.- Parameters:
state- the ServerState to adjust with
-
adjust
Adjust the lastTime of thisCsnGeneratorwith aCsnthat we have received from another server.This is necessary because we need that the
Csngenerated after processing an update received from other hosts to be as close as possible to the receivedCsnin order to have a global ordering that is close to wall-clock time.- Parameters:
csn- theCsnto adjust with
-