Package io.aeron

Class DriverProxy

java.lang.Object
io.aeron.DriverProxy

public final class DriverProxy extends Object
Separates the concern of communicating with the client conductor away from the rest of the client.

For writing commands into the client conductor buffer.

Note: this class is not thread safe and is expecting to be called within Aeron.Context.clientLock().

  • Constructor Summary

    Constructors
    Constructor
    Description
    DriverProxy(RingBuffer toDriverCommandBuffer, long clientId)
    Create a proxy to a media driver which sends commands via a RingBuffer.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    addCounter(int typeId, String label)
    Add a new counter with a type id and label, the key will be blank.
    long
    addCounter(int typeId, DirectBuffer keyBuffer, int keyOffset, int keyLength, DirectBuffer labelBuffer, int labelOffset, int labelLength)
    Add a new counter with a type id plus the label and key are provided in buffers.
    long
    addDestination(long registrationId, String endpointChannel)
    Add a destination to the send channel of an existing MDC Publication.
    long
    addExclusivePublication(String channel, int streamId)
    Instruct the driver to add a non-concurrent, i.e.
    long
    addPublication(String channel, int streamId)
    Instruct the driver to add a concurrent publication.
    long
    addRcvDestination(long registrationId, String endpointChannel)
    Add a destination to the receive channel endpoint of an existing MDS Subscription.
    long
    addSubscription(String channel, int streamId)
    Instruct the driver to add a subscription.
    void
    Notify the media driver that this client is closing.
    long
    rejectImage(long imageCorrelationId, long position, String reason)
    Reject a specific image.
    long
    removeCounter(long registrationId)
    Instruct the media driver to remove an existing counter by its registration id.
    long
    removeDestination(long publicationRegistrationId, long destinationRegistrationId)
    Remove a destination from the send channel of an existing MDC Publication.
    long
    removeDestination(long registrationId, String endpointChannel)
    Remove a destination from the send channel of an existing MDC Publication.
    long
    removePublication(long registrationId, boolean revoke)
    Instruct the driver to remove a publication by its registration id.
    long
    removeRcvDestination(long registrationId, String endpointChannel)
    Remove a destination from the receive channel endpoint of an existing MDS Subscription.
    long
    removeSubscription(long registrationId)
    Instruct the driver to remove a subscription by its registration id.
    boolean
    terminateDriver(DirectBuffer tokenBuffer, int tokenOffset, int tokenLength)
    Instruct the media driver to terminate.
    long
    Time of the last heartbeat to indicate the driver is alive.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DriverProxy

      public DriverProxy(RingBuffer toDriverCommandBuffer, long clientId)
      Create a proxy to a media driver which sends commands via a RingBuffer.
      Parameters:
      toDriverCommandBuffer - to send commands via.
      clientId - to represent the client.
  • Method Details

    • timeOfLastDriverKeepaliveMs

      public long timeOfLastDriverKeepaliveMs()
      Time of the last heartbeat to indicate the driver is alive.
      Returns:
      time of the last heartbeat to indicate the driver is alive.
    • addPublication

      public long addPublication(String channel, int streamId)
      Instruct the driver to add a concurrent publication.
      Parameters:
      channel - uri in string format.
      streamId - within the channel.
      Returns:
      the correlation id for the command.
    • addExclusivePublication

      public long addExclusivePublication(String channel, int streamId)
      Instruct the driver to add a non-concurrent, i.e. exclusive, publication.
      Parameters:
      channel - uri in string format.
      streamId - within the channel.
      Returns:
      the correlation id for the command.
    • removePublication

      public long removePublication(long registrationId, boolean revoke)
      Instruct the driver to remove a publication by its registration id.
      Parameters:
      registrationId - for the publication to be removed.
      revoke - whether the publication is being revoked.
      Returns:
      the correlation id for the command.
    • addSubscription

      public long addSubscription(String channel, int streamId)
      Instruct the driver to add a subscription.
      Parameters:
      channel - uri in string format.
      streamId - within the channel.
      Returns:
      the correlation id for the command.
    • removeSubscription

      public long removeSubscription(long registrationId)
      Instruct the driver to remove a subscription by its registration id.
      Parameters:
      registrationId - for the subscription to be removed.
      Returns:
      the correlation id for the command.
    • addDestination

      public long addDestination(long registrationId, String endpointChannel)
      Add a destination to the send channel of an existing MDC Publication.
      Parameters:
      registrationId - of the Publication.
      endpointChannel - for the destination.
      Returns:
      the correlation id for the command.
    • removeDestination

      public long removeDestination(long registrationId, String endpointChannel)
      Remove a destination from the send channel of an existing MDC Publication.
      Parameters:
      registrationId - of the Publication.
      endpointChannel - used for the addDestination(long, String) command.
      Returns:
      the correlation id for the command.
    • removeDestination

      public long removeDestination(long publicationRegistrationId, long destinationRegistrationId)
      Remove a destination from the send channel of an existing MDC Publication.
      Parameters:
      publicationRegistrationId - of the Publication.
      destinationRegistrationId - used for the addDestination(long, String) command.
      Returns:
      the correlation id for the command.
    • addRcvDestination

      public long addRcvDestination(long registrationId, String endpointChannel)
      Add a destination to the receive channel endpoint of an existing MDS Subscription.
      Parameters:
      registrationId - of the Subscription.
      endpointChannel - for the destination.
      Returns:
      the correlation id for the command.
    • removeRcvDestination

      public long removeRcvDestination(long registrationId, String endpointChannel)
      Remove a destination from the receive channel endpoint of an existing MDS Subscription.
      Parameters:
      registrationId - of the Subscription.
      endpointChannel - used for the addRcvDestination(long, String) command.
      Returns:
      the correlation id for the command.
    • addCounter

      public long addCounter(int typeId, DirectBuffer keyBuffer, int keyOffset, int keyLength, DirectBuffer labelBuffer, int labelOffset, int labelLength)
      Add a new counter with a type id plus the label and key are provided in buffers.
      Parameters:
      typeId - for associating with the counter.
      keyBuffer - containing the metadata key.
      keyOffset - offset at which the key begins.
      keyLength - length in bytes for the key.
      labelBuffer - containing the label.
      labelOffset - offset at which the label begins.
      labelLength - length in bytes for the label.
      Returns:
      the correlation id for the command.
    • addCounter

      public long addCounter(int typeId, String label)
      Add a new counter with a type id and label, the key will be blank.
      Parameters:
      typeId - for associating with the counter.
      label - that is human-readable for the counter.
      Returns:
      the correlation id for the command.
    • removeCounter

      public long removeCounter(long registrationId)
      Instruct the media driver to remove an existing counter by its registration id.
      Parameters:
      registrationId - of counter to remove.
      Returns:
      the correlation id for the command.
    • clientClose

      public void clientClose()
      Notify the media driver that this client is closing.
    • terminateDriver

      public boolean terminateDriver(DirectBuffer tokenBuffer, int tokenOffset, int tokenLength)
      Instruct the media driver to terminate.
      Parameters:
      tokenBuffer - containing the authentication token.
      tokenOffset - at which the token begins.
      tokenLength - in bytes.
      Returns:
      true is successfully sent.
    • rejectImage

      public long rejectImage(long imageCorrelationId, long position, String reason)
      Reject a specific image.
      Parameters:
      imageCorrelationId - of the image to be invalidated
      position - of the image when invalidation occurred
      reason - user supplied reason for invalidation, reported back to publication
      Returns:
      the correlationId of the request for invalidation.
    • toString

      public String toString()
      Overrides:
      toString in class Object