Interface CongestionControl

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
CubicCongestionControl, StaticWindowCongestionControl

public interface CongestionControl extends AutoCloseable
Strategy for applying congestion control to determine the receiver window length of the Status Messages.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Bit flag for if a status message should be forced out.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    int
    Called by DriverConductor to initialise window length for a new PublicationImage.
    int
    Called by DriverConductor limit the window length for a new PublicationImage.
    void
    onRttMeasurement(long nowNs, long rttNs, InetSocketAddress srcAddress)
    Called by Receiver on reception of an RTT Measurement.
    void
    Called by Receiver to record that a measurement request has been sent.
    long
    onTrackRebuild(long nowNs, long newConsumptionPosition, long lastSmPosition, long hwmPosition, long startingRebuildPosition, long endingRebuildPosition, boolean lossOccurred)
    Called by DriverConductor upon execution of PublicationImage.trackRebuild(long) to pass on current status.
    static long
    packOutcome(int receiverWindowLength, boolean forceStatusMessage)
    Pack values into a long, so they can be returned on the stack without allocation.
    static int
    receiverWindowLength(long outcome)
    Extract the receiver window length from the packed value.
    static boolean
    Extract the boolean value for if a status message should be forced from the packed value.
    boolean
    shouldMeasureRtt(long nowNs)
    Polled by Receiver to determine when to initiate an RTT measurement to a Sender.
    static int
    threshold(int windowLength)
    Threshold increment in a window after which a status message should be scheduled.
  • Field Details

    • FORCE_STATUS_MESSAGE_BIT

      static final int FORCE_STATUS_MESSAGE_BIT
      Bit flag for if a status message should be forced out.
      See Also:
  • Method Details

    • packOutcome

      static long packOutcome(int receiverWindowLength, boolean forceStatusMessage)
      Pack values into a long, so they can be returned on the stack without allocation.
      Parameters:
      receiverWindowLength - to go in the lower bits.
      forceStatusMessage - to go in the higher bits.
      Returns:
      the packed value.
    • receiverWindowLength

      static int receiverWindowLength(long outcome)
      Extract the receiver window length from the packed value.
      Parameters:
      outcome - as the packed value.
      Returns:
      the receiver window length.
    • shouldForceStatusMessage

      static boolean shouldForceStatusMessage(long outcome)
      Extract the boolean value for if a status message should be forced from the packed value.
      Parameters:
      outcome - which is packed containing the force status message flag.
      Returns:
      true if the force status message bit has been set.
    • threshold

      static int threshold(int windowLength)
      Threshold increment in a window after which a status message should be scheduled.
      Parameters:
      windowLength - to calculate the threshold from.
      Returns:
      the threshold in the window after which a status message should be scheduled.
    • shouldMeasureRtt

      boolean shouldMeasureRtt(long nowNs)
      Polled by Receiver to determine when to initiate an RTT measurement to a Sender.
      Parameters:
      nowNs - in nanoseconds
      Returns:
      true for should measure RTT now or false for no measurement
    • onRttMeasurementSent

      void onRttMeasurementSent(long nowNs)
      Called by Receiver to record that a measurement request has been sent.
      Parameters:
      nowNs - in nanoseconds.
    • onRttMeasurement

      void onRttMeasurement(long nowNs, long rttNs, InetSocketAddress srcAddress)
      Called by Receiver on reception of an RTT Measurement.
      Parameters:
      nowNs - in nanoseconds
      rttNs - to the Sender in nanoseconds
      srcAddress - of the Sender
    • onTrackRebuild

      long onTrackRebuild(long nowNs, long newConsumptionPosition, long lastSmPosition, long hwmPosition, long startingRebuildPosition, long endingRebuildPosition, boolean lossOccurred)
      Called by DriverConductor upon execution of PublicationImage.trackRebuild(long) to pass on current status.

      The return value must be packed using packOutcome(int, boolean).

      Parameters:
      nowNs - current time
      newConsumptionPosition - of the subscribers
      lastSmPosition - of the image
      hwmPosition - of the image
      startingRebuildPosition - of the rebuild
      endingRebuildPosition - of the rebuild
      lossOccurred - during rebuild
      Returns:
      outcome of congestion control calculation containing window length and whether to force sending an SM.
    • initialWindowLength

      int initialWindowLength()
      Called by DriverConductor to initialise window length for a new PublicationImage.
      Returns:
      initial window length for flow and congestion control.
    • maxWindowLength

      int maxWindowLength()
      Called by DriverConductor limit the window length for a new PublicationImage.
      Returns:
      maximum window length for flow and congestion control.
    • close

      void close()
      Specified by:
      close in interface AutoCloseable