Class CSNGenerator
java.lang.Object
org.opends.server.replication.common.CSNGenerator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Generate a sequence number for a stream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adjust the lastTime of thisCSNGenerator
with aCSN
that we have received from another server.void
adjust
(ServerState state) Adjust utility method that takes ServerState as a parameter.Returns the generatedCSN
.generateCsnV3
(long streamTimeStamp, long curTime, CSNGenerator.StreamSequenceNumberGenerator streamSeqNumGen) Generate a newCSN
using the V3 format.static boolean
isSequenceBroken
(CSN csn1, CSN csn2) Checks whether the sequence is broken between twoCSN
s.static CSNGenerator
newCSNGenerator
(ReplicaId replicaId, long timestamp) Create a newCSNGenerator
.static CSNGenerator
newCSNGenerator
(ReplicaId replicaId, LongSupplier timeSupplier) Create a newCSNGenerator
.Returns a newCSNGenerator.StreamSequenceNumberGenerator
.static long
nextStreamSeqNum
(long streamSeqNum) Returns the next stream sequence number.
-
Method Details
-
newCSNGenerator
Create a newCSNGenerator
.- Parameters:
replicaId
- id to use when creatingCSN
s.timestamp
- time to start with.- Returns:
- the new
CSNGenerator
-
newCSNGenerator
Create a newCSNGenerator
.- Parameters:
replicaId
- the replicaId to use when creatingCSN
stimeSupplier
- the timestamp supplier- Returns:
- the new
CSNGenerator
-
newStreamSequenceNumberGenerator
Returns a newCSNGenerator.StreamSequenceNumberGenerator
.- Returns:
- a new
CSNGenerator.StreamSequenceNumberGenerator
-
generateCsn
Returns the generatedCSN
.- Returns:
- the generated
CSN
-
generateCsnV3
public CSN generateCsnV3(long streamTimeStamp, long curTime, CSNGenerator.StreamSequenceNumberGenerator streamSeqNumGen) Generate a newCSN
using 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
Checks whether the sequence is broken between twoCSN
s. -
adjust
Adjust utility method that takes ServerState as a parameter.- Parameters:
state
- the ServerState to adjust with
-
adjust
Adjust the lastTime of thisCSNGenerator
with aCSN
that we have received from another server.This is necessary because we need that the
CSN
generated after processing an update received from other hosts to be as close as possible to the receivedCSN
in order to have a global ordering that is close to wall-clock time.- Parameters:
csn
- theCSN
to adjust with
-