public class DefaultApplicationState extends java.lang.Object implements ApplicationState
Modifier and Type | Field and Description |
---|---|
protected boolean |
hasState |
protected int |
lastEid |
protected byte[] |
state |
protected byte[] |
stateHash |
Constructor and Description |
---|
DefaultApplicationState()
Constructs a TansferableState
This constructor should be used when there isn't a valid state to construct the object with
|
DefaultApplicationState(CommandsInfo[] messageBatches,
byte[] logHash,
int lastCheckpointEid,
int lastCheckpointRound,
int lastCheckpointLeader,
int lastEid,
byte[] state,
byte[] stateHash) |
DefaultApplicationState(CommandsInfo[] messageBatches,
int lastCheckpointEid,
int lastCheckpointRound,
int lastCheckpointLeader,
int lastEid,
byte[] state,
byte[] stateHash)
Constructs a TansferableState
This constructor should be used when there is a valid state to construct the object with
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
This method MUST be implemented.
|
int |
getLastCheckpointEid()
Retrieves the execution ID for the last checkpoint
|
int |
getLastCheckpointLeader()
Retrieves the leader for the last checkpoint
|
int |
getLastCheckpointRound()
Retrieves the decision round for the last checkpoint
|
int |
getLastEid()
Retrieves the execution ID for the last messages batch delivered to the application
|
CommandsInfo |
getMessageBatch(int eid)
Retrieves the specified batch of messages
|
CommandsInfo[] |
getMessageBatches()
Retrieves all batches of messages
|
byte[] |
getSerializedState()
Byte array that must be a representation of the application state
|
byte[] |
getState()
Retrieves the state associated with the last checkpoint
|
byte[] |
getStateHash()
Retrieves the hash of the state associated with the last checkpoint
|
int |
hashCode()
This method MUST be implemented.
|
boolean |
hasState()
Indicates if the TransferableState object has a valid state
|
void |
setMessageBatches(CommandsInfo[] messageBatches) |
void |
setSerializedState(byte[] state)
Sets a byte array that must be a representation of the application state
|
void |
setState(byte[] state)
Sets the state associated with the last checkpoint
|
protected byte[] state
protected byte[] stateHash
protected int lastEid
protected boolean hasState
public DefaultApplicationState(CommandsInfo[] messageBatches, int lastCheckpointEid, int lastCheckpointRound, int lastCheckpointLeader, int lastEid, byte[] state, byte[] stateHash)
messageBatches
- Batches received since the last checkpoint.state
- State associated with the last checkpointstateHash
- Hash of the state associated with the last checkpointpublic DefaultApplicationState(CommandsInfo[] messageBatches, byte[] logHash, int lastCheckpointEid, int lastCheckpointRound, int lastCheckpointLeader, int lastEid, byte[] state, byte[] stateHash)
public DefaultApplicationState()
public void setSerializedState(byte[] state)
ApplicationState
setSerializedState
in interface ApplicationState
state
- a byte array that must be a representation of the application statepublic byte[] getSerializedState()
ApplicationState
getSerializedState
in interface ApplicationState
public boolean hasState()
hasState
in interface ApplicationState
public int getLastEid()
getLastEid
in interface ApplicationState
public byte[] getState()
public byte[] getStateHash()
getStateHash
in interface ApplicationState
public void setState(byte[] state)
state
- State associated with the last checkpointpublic CommandsInfo[] getMessageBatches()
public void setMessageBatches(CommandsInfo[] messageBatches)
public CommandsInfo getMessageBatch(int eid)
eid
- Execution ID associated with the batch to be fetchedpublic int getLastCheckpointEid()
public int getLastCheckpointRound()
public int getLastCheckpointLeader()
public boolean equals(java.lang.Object obj)
ApplicationState
equals
in interface ApplicationState
equals
in class java.lang.Object
public int hashCode()
ApplicationState
hashCode
in interface ApplicationState
hashCode
in class java.lang.Object