bftsmart.tom

## Class MessageContext

- java.lang.Object
- - bftsmart.tom.MessageContext

All Implemented Interfaces:
  java.io.Serializable

    public class MessageContext
    extends java.lang.Object
    implements java.io.Serializable

This class represents the whole context of a request ordered in the system. It stores all informations regarding the message sent by the client, as well as the consensus instance in which it was ordered.

See Also:
  Serialized Form

### Field Summary

Fields
`boolean` `readOnly`

### Constructor Summary

Constructors
Constructor and Description
`MessageContext(int sender, int viewID, bftsmart.tom.core.messages.TOMMessageType type, int session, int sequence, int operationId, int replyServer, byte[] signature, long timestamp, int numOfNonces, long seed, int regency, int leader, int consensusId, java.util.Set<bftsmart.consensus.messages.ConsensusMessage> proof, bftsmart.tom.core.messages.TOMMessage firstInBatch, boolean noOp)` Constructor

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `getConsensusId()`
`bftsmart.tom.core.messages.TOMMessage` `getFirstInBatch()`
`int` `getLeader()`
`byte[]` `getNonces()`
`int` `getNumOfNonces()`
`int` `getOperationId()`
`java.util.Set<bftsmart.consensus.messages.ConsensusMessage>` `getProof()`
`int` `getRegency()`
`int` `getReplyServer()`
`long` `getSeed()`
`int` `getSender()` Returns the sender of the message
`int` `getSequence()`
`static long` `getSerialVersionUID()`
`int` `getSession()`
`byte[]` `getSignature()`
`long` `getTimestamp()`
`bftsmart.tom.core.messages.TOMMessageType` `getType()`
`int` `getViewID()`
`boolean` `isLastInBatch()`
`boolean` `isNoOp()`
`bftsmart.tom.core.messages.TOMMessage` `recreateTOMMessage(byte[] content)` Generates a TOMMessage for its associated requests using the new info that it now supports since the previous commit.
`void` `setLastInBatch()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### readOnly

    public boolean readOnly

### Constructor Detail

#### MessageContext

    public MessageContext(int sender,
                          int viewID,
                          bftsmart.tom.core.messages.TOMMessageType type,
                          int session,
                          int sequence,
                          int operationId,
                          int replyServer,
                          byte[] signature,
                          long timestamp,
                          int numOfNonces,
                          long seed,
                          int regency,
                          int leader,
                          int consensusId,
                          java.util.Set<bftsmart.consensus.messages.ConsensusMessage> proof,
                          bftsmart.tom.core.messages.TOMMessage firstInBatch,
                          boolean noOp)

Constructor

Parameters:
  `sender` -
  `viewID` -
  `type` -
  `session` -
  `sequence` -
  `operationId` -
  `replyServer` -
  `signature` -
  `timestamp` -
  `numOfNonces` -
  `seed` -
  `regency` -
  `leader` -
  `consensusId` -
  `proof` -
  `firstInBatch` -
  `noOp` -

### Method Detail

#### getSerialVersionUID

    public static long getSerialVersionUID()

#### getViewID

    public int getViewID()

#### getType

    public bftsmart.tom.core.messages.TOMMessageType getType()

#### getSession

    public int getSession()

#### getSequence

    public int getSequence()

#### getOperationId

    public int getOperationId()

#### getReplyServer

    public int getReplyServer()

#### getSignature

    public byte[] getSignature()

#### getSender

    public int getSender()

Returns the sender of the message

Returns:
  The sender of the message

#### getTimestamp

    public long getTimestamp()

Returns:
  the timestamp

#### getNonces

    public byte[] getNonces()

Returns:
  the nonces

#### getNumOfNonces

    public int getNumOfNonces()

#### getSeed

    public long getSeed()

#### getConsensusId

    public int getConsensusId()

Returns:
  the consensusId

#### getLeader

    public int getLeader()

Returns:
  the leader with which the batch was decided

#### getProof

    public java.util.Set<bftsmart.consensus.messages.ConsensusMessage> getProof()

Returns:
  the proof for the consensus

#### getRegency

    public int getRegency()

Returns:
  the regency

#### getFirstInBatch

    public bftsmart.tom.core.messages.TOMMessage getFirstInBatch()

Returns:
  the first message in the ordered batch

#### setLastInBatch

    public void setLastInBatch()

#### isLastInBatch

    public boolean isLastInBatch()

#### isNoOp

    public boolean isNoOp()

#### recreateTOMMessage

    public bftsmart.tom.core.messages.TOMMessage recreateTOMMessage(byte[] content)

Generates a TOMMessage for its associated requests using the new info that it now supports since the previous commit. It is assumed that the byte array passed to this method is the serialized request associated to the original TOMMessage.

Parameters:
  `content` - Serialized request associated to the original TOMMessage.
Returns:
  A TOMMessage object that is equal to the original object issued by the client