public class DefaultApplicationState
extends java.lang.Object
implements bftsmart.statemanagement.ApplicationState
Modifier and Type | Field and Description |
---|---|
protected boolean |
hasState |
protected int |
lastCID |
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 lastCheckpointCID,
int lastCID,
byte[] state,
byte[] stateHash,
int pid) |
DefaultApplicationState(CommandsInfo[] messageBatches,
int lastCheckpointCID,
int lastCID,
byte[] state,
byte[] stateHash,
int pid)
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.
|
bftsmart.tom.leaderchange.CertifiedDecision |
getCertifiedDecision(bftsmart.reconfiguration.ServerViewController controller)
Retrieves the certified decision for the last consensus present in this object
|
int |
getLastCheckpointCID()
Retrieves the consensus ID for the last checkpoint
|
int |
getLastCID()
Retrieves the consensus ID for the last messages batch delivered to the application
|
CommandsInfo |
getMessageBatch(int cid)
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 lastCID
protected boolean hasState
public DefaultApplicationState(CommandsInfo[] messageBatches, int lastCheckpointCID, int lastCID, byte[] state, byte[] stateHash, int pid)
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 lastCheckpointCID, int lastCID, byte[] state, byte[] stateHash, int pid)
public DefaultApplicationState()
public void setSerializedState(byte[] state)
bftsmart.statemanagement.ApplicationState
setSerializedState
in interface bftsmart.statemanagement.ApplicationState
state
- a byte array that must be a representation of the application statepublic byte[] getSerializedState()
bftsmart.statemanagement.ApplicationState
getSerializedState
in interface bftsmart.statemanagement.ApplicationState
public boolean hasState()
hasState
in interface bftsmart.statemanagement.ApplicationState
public int getLastCID()
getLastCID
in interface bftsmart.statemanagement.ApplicationState
public bftsmart.tom.leaderchange.CertifiedDecision getCertifiedDecision(bftsmart.reconfiguration.ServerViewController controller)
getCertifiedDecision
in interface bftsmart.statemanagement.ApplicationState
controller
- public byte[] getState()
public byte[] getStateHash()
getStateHash
in interface bftsmart.statemanagement.ApplicationState
public void setState(byte[] state)
state
- State associated with the last checkpointpublic CommandsInfo[] getMessageBatches()
public void setMessageBatches(CommandsInfo[] messageBatches)
public CommandsInfo getMessageBatch(int cid)
cid
- Consensus ID associated with the batch to be fetchedpublic int getLastCheckpointCID()
public boolean equals(java.lang.Object obj)
bftsmart.statemanagement.ApplicationState
equals
in interface bftsmart.statemanagement.ApplicationState
equals
in class java.lang.Object
public int hashCode()
bftsmart.statemanagement.ApplicationState
hashCode
in interface bftsmart.statemanagement.ApplicationState
hashCode
in class java.lang.Object