Class StreamCounter

java.lang.Object
io.aeron.driver.status.StreamCounter

public class StreamCounter extends Object
Allocates counters on a stream of messages.

Positions tracked in bytes include:

  • Field Details

    • REGISTRATION_ID_OFFSET

      public static final int REGISTRATION_ID_OFFSET
      Offset in the key metadata for the registration id of the counter.
      See Also:
    • SESSION_ID_OFFSET

      public static final int SESSION_ID_OFFSET
      Offset in the key metadata for the session id of the counter.
      See Also:
    • STREAM_ID_OFFSET

      public static final int STREAM_ID_OFFSET
      Offset in the key metadata for the stream id of the counter.
      See Also:
    • CHANNEL_OFFSET

      public static final int CHANNEL_OFFSET
      Offset in the key metadata for the channel of the counter.
      See Also:
    • MAX_CHANNEL_LENGTH

      public static final int MAX_CHANNEL_LENGTH
      The maximum length in bytes of the encoded channel identity.
      See Also:
  • Constructor Details

    • StreamCounter

      public StreamCounter()
  • Method Details

    • allocateCounterId

      public static int allocateCounterId(MutableDirectBuffer tempBuffer, String name, int typeId, CountersManager countersManager, long clientId, long registrationId, int sessionId, int streamId, String channel, long joinPosition)
      Allocate a counter id for tracking a position on a stream of messages.
      Parameters:
      tempBuffer - to be used for labels and key.
      name - of the counter for the label.
      typeId - of the counter for classification.
      countersManager - from which the underlying storage is allocated.
      clientId - to set as counter owner.
      registrationId - to be associated with the counter.
      sessionId - for the stream of messages.
      streamId - for the stream of messages.
      channel - for the stream of messages.
      joinPosition - relevant for `sub-pos` only.
      Returns:
      the id of the allocated counter.