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 MessageRemote
create
(Connection peerConnection, ACell o) static MessageRemote
create
(Connection peerConnection, MessageType type, ACell payload) static Message
createBelief
(SignedData<Belief> sb) static Message
createChallenge
(SignedData<ACell> challenge) static Message
createData
(ACell o) static Message
createGoodBye
(SignedData<ACell> peerKey) static Message
createResponse
(SignedData<ACell> response) getID()
Gets the message ID for correlation, assuming this message type supports IDs.abstract String
Gets a String identifying the origin of the message.<T extends ACell>
TgetType()
abstract boolean
reportResult
(CVMLong id, ACell reply) Report a result for a given message IDabstract boolean
reportResult
(Result res) Reports a result back to the originator of the message.abstract boolean
Sends a cell of data to the connected Peerabstract boolean
sendMissingData
(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
-