Package convex.net.message
Class MessageLocal
java.lang.Object
convex.net.message.Message
convex.net.message.MessageLocal
Class representing a message to a local Server instance
-
Field Summary
FieldsFields inherited from class convex.net.message.Message
log, messageData, payload, type
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MessageLocal
(MessageType type, ACell payload, Server server, Consumer<Result> handler) -
Method Summary
Modifier and TypeMethodDescriptionvoid
static MessageLocal
Create an instance with the given message dataGets the Connection instance associated with this message, or null if no connection exists (presumably a local Message)Gets a String identifying the origin of the message.boolean
reportResult
(Result res) Reports a result back to the originator of the message.boolean
Sends a cell of data to the connected Peerboolean
sendMissingData
(Hash hash) Returns a missing data request to the connected PeerMethods inherited from class convex.net.message.Message
create, createBelief, createBelief, createBeliefRequest, createChallenge, createData, createGoodBye, createMissingData, createMissingData, createResponse, createResult, createResult, getID, getMessageData, getPayload, getType, hasData, toString
-
Field Details
-
server
-
store
-
resultHandler
-
-
Constructor Details
-
MessageLocal
-
-
Method Details
-
create
public static MessageLocal create(MessageType type, ACell payload, Server server, Consumer<Result> handler) Create an instance with the given message data- Parameters:
type
- Message typepayload
- Message payloadserver
- Local server instancehandler
- Handler for Results- Returns:
- New MessageLocal instance
-
reportResult
Description copied from class:Message
Reports a result back to the originator of the message. Will set a Result ID if necessary.- Specified by:
reportResult
in classMessage
- Parameters:
res
- Result record- Returns:
- True if reported successfully, false otherwise
-
getOriginString
Description copied from class:Message
Gets a String identifying the origin of the message. Used for logging.- Specified by:
getOriginString
in classMessage
- Returns:
- String representing message origin
-
sendData
Description copied from class:Message
Sends a cell of data to the connected Peer -
sendMissingData
Description copied from class:Message
Returns a missing data request to the connected Peer- Specified by:
sendMissingData
in classMessage
- Parameters:
hash
- Hash of missing data- Returns:
- True if request sent, false otherwise
-
getConnection
Description copied from class:Message
Gets the Connection instance associated with this message, or null if no connection exists (presumably a local Message)- Specified by:
getConnection
in classMessage
- Returns:
- Connection instance
-
closeConnection
public void closeConnection()- Specified by:
closeConnection
in classMessage
-