Class MessageLocal

java.lang.Object
convex.net.message.Message
convex.net.message.MessageLocal

public class MessageLocal extends Message
Class representing a message to a local Server instance
  • Field Details

  • Constructor Details

  • 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 type
      payload - Message payload
      server - Local server instance
      handler - Handler for Results
      Returns:
      New MessageLocal instance
    • reportResult

      public boolean reportResult(Result res)
      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 class Message
      Parameters:
      res - Result record
      Returns:
      True if reported successfully, false otherwise
    • getOriginString

      public String getOriginString()
      Description copied from class: Message
      Gets a String identifying the origin of the message. Used for logging.
      Specified by:
      getOriginString in class Message
      Returns:
      String representing message origin
    • sendData

      public boolean sendData(ACell data)
      Description copied from class: Message
      Sends a cell of data to the connected Peer
      Specified by:
      sendData in class Message
      Parameters:
      data - Cell value to send
      Returns:
      true if data sent, false otherwise
    • sendMissingData

      public boolean sendMissingData(Hash hash)
      Description copied from class: Message
      Returns a missing data request to the connected Peer
      Specified by:
      sendMissingData in class Message
      Parameters:
      hash - Hash of missing data
      Returns:
      True if request sent, false otherwise
    • getConnection

      public Connection 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 class Message
      Returns:
      Connection instance
    • closeConnection

      public void closeConnection()
      Specified by:
      closeConnection in class Message