Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Transport Layer abstracts the communication pipeline, allowing two nodes sending messages between each other.
Specification of how TransportLayer should work is defined in The specification below is governed by TransportLayerSpec.scala, see code for details.  

   when doing a round trip to remote peer
      when everything is fine
         - should send and receive the message
      when response takes to long
         - should fail with a timeout
       when there is no response body
         - should fail with a communication error
       when peer is not listening
         - should fail with peer unavailable error
       when there was a peer-side error
         - should fail with an internal communication error
   when sending a message
     - should deliver the message
     - should not wait for a response
     - should wait for message being delivered (pending)
   when brodacasting a message
     - should send the message to all peers
   when shutting down
      when doing a round trip
         - should not send the message
      when sending a message
        - should not send the message
      when broadcasting a message
        - should not send any messages

Transport Layer exposes following functions:

trait TransportLayer[F[_]] {
  def local: F[PeerNode]
  def roundTrip(peer: PeerNode, msg: Protocol, timeout: FiniteDuration): F[CommErr[Protocol]]
  def send(peer: PeerNode, msg: Protocol): F[Unit]
  def broadcast(peers: Seq[PeerNode], msg: Protocol): F[Unit]
  def receive(dispatch: Protocol => F[CommunicationResponse]): F[Unit]
  def disconnect(peer: PeerNode): F[Unit]
  def shutdown(msg: Protocol): F[Unit]