Package convex.net.message
Class Message
java.lang.Object
convex.net.message.Message
- Direct Known Subclasses:
MessageLocal,MessageRemote
Class representing a message to / from a specific connection
Encapsulates both message content and a means of return communication
.This class is an immutable data structure, but NOT a representable on-chain data structure, as it is part of the peer protocol layer.
Messages may contain a Payload, which can be any Data Object.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MessageRemotecreate(Connection peerConnection, ACell o) static MessageRemotecreate(Connection peerConnection, MessageType type, ACell payload) static MessagecreateBelief(SignedData<Belief> sb) static MessagecreateChallenge(SignedData<ACell> challenge) static MessagecreateData(ACell o) static MessagecreateGoodBye(SignedData<ACell> peerKey) static MessagecreateResponse(SignedData<ACell> response) getID()Gets the message ID for correlation, assuming this message type supports IDs.abstract StringGets a String identifying the origin of the message.<T extends ACell>
TgetType()abstract booleanreportResult(CVMLong id, ACell reply) Report a result for a given message IDabstract booleanreportResult(Result res) Reports a result back to the originator of the message.abstract booleanSends a cell of data to the connected Peerabstract booleansendMissingData(Hash hash) Sends a missing data request to the connected PeertoString()
-
Field Details
-
payload
-
type
-
-
Constructor Details
-
Message
-
-
Method Details
-
create
-
create
-
createData
-
createBelief
-
createChallenge
-
createResponse
-
createGoodBye
-
getPayload
-
getType
-
getErrorCode
-
toString
-
getID
Gets the message ID for correlation, assuming this message type supports IDs.- Returns:
- Message ID, or null if the message type does not use message IDs
-
reportResult
Reports a result back to the originator of the message. Will set a Result ID if necessary.- Parameters:
res- Result record- Returns:
- True if reported successfully, false otherwise
-
reportResult
Report a result for a given message ID- Parameters:
id- Message IDreply- Value for result- Returns:
- True if reported successfully, false otherwise
-
getOriginString
Gets a String identifying the origin of the message. Used for logging.- Returns:
- String representing message origin
-
sendData
Sends a cell of data to the connected Peer- Parameters:
data- Data to send- Returns:
- true if data sent, false otherwise
-
sendMissingData
Sends a missing data request to the connected Peer- Parameters:
hash- HAsh of missing data- Returns:
- True if request sent, false otherwise
-