public class UpdateMsg extends ReplicationMsg implements Comparable<UpdateMsg>
Modifier and Type | Field and Description |
---|---|
protected boolean |
assuredFlag
True when the update must use assured replication.
|
protected AssuredMode |
assuredMode
When assuredFlag is true, defines the requested assured mode.
|
protected CSN |
csn
The CSN of this update.
|
protected short |
protocolVersion
Protocol version.
|
protected byte |
safeDataLevel
When assured mode is safe data, gives the requested level.
|
MSG_TYPE_DISK_ENCODING
Modifier | Constructor and Description |
---|---|
protected |
UpdateMsg()
Creates a new empty UpdateMsg.
|
|
UpdateMsg(CSN csn,
byte[] payload)
Creates a new UpdateMsg with the given informations.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(UpdateMsg msg) |
boolean |
contributesToDomainState()
Whether the current message can update the "ds-sync-state" attribute.
|
protected void |
decodeHeader(byte allowedType,
ByteArrayScanner scanner)
Decode the Header part of this Update message, and check its type.
|
protected ByteArrayBuilder |
encodeHeader(byte msgType,
short protocolVersion)
Encode the common header for all the UpdateMsg.
|
boolean |
equals(Object obj) |
AssuredMode |
getAssuredMode()
Get the assured mode in this message.
|
byte[] |
getBytes()
Returns the encoded representation of this update message using the current
protocol version.
|
byte[] |
getBytes(short protocolVersion)
This implementation is only called during unit testing, so we are free to
force the protocol version.
|
CSN |
getCSN()
Get the CSN from the message.
|
byte[] |
getPayload()
Get the payload of the UpdateMsg.
|
byte |
getSafeDataLevel()
Get the safe data level in this message.
|
short |
getVersion()
Get the version included in the update message.
|
int |
hashCode() |
boolean |
isAssured()
Get a boolean indicating if the Update must be processed as an
Asynchronous or as an assured replication.
|
void |
setAssured(boolean assured)
Set the Update message as an assured message.
|
void |
setAssuredMode(AssuredMode assuredMode)
Set the assured mode.
|
void |
setSafeDataLevel(byte safeDataLevel)
Set the safe data level.
|
int |
size()
Return the number of bytes used by this message.
|
generateMsg
protected short protocolVersion
protected boolean assuredFlag
protected AssuredMode assuredMode
protected byte safeDataLevel
protected UpdateMsg()
public boolean isAssured()
public void setAssured(boolean assured)
assured
- If the message is assured or not. Using true implies
setAssuredMode method must be called.public int compareTo(UpdateMsg msg)
compareTo
in interface Comparable<UpdateMsg>
public AssuredMode getAssuredMode()
public byte getSafeDataLevel()
public void setAssuredMode(AssuredMode assuredMode)
assuredMode
- The chosen assured mode.public void setSafeDataLevel(byte safeDataLevel)
safeDataLevel
- The chosen safe data level.public short getVersion()
public int size()
protected ByteArrayBuilder encodeHeader(byte msgType, short protocolVersion)
msgType
- The type of UpdateMsg to encode.protocolVersion
- The ProtocolVersion to use when encoding.protected void decodeHeader(byte allowedType, ByteArrayScanner scanner) throws DataFormatException
allowedType
- The allowed type of this Update Message.scanner
- The encoded form of the UpdateMsg.DataFormatException
- if the scanner does not contain a valid common header.public byte[] getBytes()
public byte[] getBytes(short protocolVersion)
getBytes
in class ReplicationMsg
protocolVersion
- The protocol version to use for serialization. The version should
normally be older than the current one.null
if the message isn't supported
in that protocol version.public byte[] getPayload()
public boolean contributesToDomainState()
Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.