public class Csn extends Object implements Comparable<Csn>
<CSN> ::= <timestamp> # <changeCount> # <replicaId> # <modifierNumber> <timestamp> ::= A GMT based time, YYYYmmddHHMMSS.uuuuuuZ <changeCount> ::= [000000-ffffff] <replicaId> ::= [000-fff] <modifierNumber> ::= [000000-ffffff]It distinguishes a change made on an object on a server, and if two operations take place during the same timeStamp, the operation sequence number makes those operations distinct.
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
bytes
Stores the byte array representation of the CSN
|
private int |
changeCount
The changeCount to distinguish operations done in the same second
|
private String |
csnStr
Stores the String representation of the CSN
|
private static org.slf4j.Logger |
LOG
The logger for this class
|
private int |
operationNumber
The operation number in a modification operation
|
private static String[] |
PADDING_3
Padding used to format number with a fixed size
|
private static String[] |
PADDING_6
Padding used to format number with a fixed size
|
private int |
replicaId
The server identification
|
private SimpleDateFormat |
sdf
The Timestamp syntax.
|
private long |
timestamp
The timeStamp of this operation
|
private static TimeZone |
UTC_TIME_ZONE |
| Constructor and Description |
|---|
Csn(byte[] value)
Creates a new instance of SimpleCSN from the serialized data
|
Csn(long timestamp,
int changeCount,
int replicaId,
int operationNumber)
Creates a new instance.
|
Csn(String value)
Creates a new instance of SimpleCSN from a String.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Csn csn)
Compares this object with the specified object for order.
|
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one
|
byte[] |
getBytes()
Get the CSN as a byte array.
|
int |
getChangeCount() |
int |
getOperationNumber() |
int |
getReplicaId() |
private int |
getReplicaIdCompareResult(Csn csn) |
long |
getTimestamp() |
int |
hashCode()
Returns a hash code value for the object.
|
static boolean |
isValid(String value)
Check if the given String is a valid CSN.
|
String |
toString() |
private static final org.slf4j.Logger LOG
private final long timestamp
private final int replicaId
private final int operationNumber
private final int changeCount
private String csnStr
private byte[] bytes
private final SimpleDateFormat sdf
private static final TimeZone UTC_TIME_ZONE
private static final String[] PADDING_6
private static final String[] PADDING_3
public Csn(long timestamp,
int changeCount,
int replicaId,
int operationNumber)
timestamp - GMT timestamp of modificationchangeCount - The operation incrementreplicaId - Replica ID where modification occurred ([-_A-Za-z0-9]{1,16})operationNumber - Operation number in a modification operationpublic Csn(String value)
value - The String containing the CSNCsn(byte[] value)
value - The byte array which contains the serialized CSNpublic static boolean isValid(String value)
value - The String to checktrue if the String is a valid CSNpublic byte[] getBytes()
public long getTimestamp()
public int getChangeCount()
public int getReplicaId()
public int getOperationNumber()
public int hashCode()
public boolean equals(Object o)
public int compareTo(Csn csn)
compareTo in interface Comparable<Csn>csn - the Object to be compared.private int getReplicaIdCompareResult(Csn csn)
Copyright © 2003–2022 The Apache Software Foundation. All rights reserved.