Class RecordingPos

java.lang.Object
io.aeron.archive.status.RecordingPos

public final class RecordingPos extends Object
The position a recording has reached when being archived.

Key has the following layout:

   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                        Recording ID                           |
  |                                                               |
  +---------------------------------------------------------------+
  |                         Session ID                            |
  +---------------------------------------------------------------+
  |                Source Identity for the Image                  |
  |                                                              ...
 ...                                                              |
  +---------------------------------------------------------------+
  |                         Archive ID                            |
  |                                                               |
  +---------------------------------------------------------------+
 
  • Field Details

    • RECORDING_POSITION_TYPE_ID

      public static final int RECORDING_POSITION_TYPE_ID
      Type id of a recording position counter.
      See Also:
    • NULL_RECORDING_ID

      public static final long NULL_RECORDING_ID
      Represents a null recording id when not found.
      See Also:
    • NAME

      public static final String NAME
      Human-readable name for the counter.
      See Also:
  • Constructor Details

    • RecordingPos

      public RecordingPos()
  • Method Details

    • allocate

      public static Counter allocate(Aeron aeron, UnsafeBuffer tempBuffer, long archiveId, long recordingId, int sessionId, int streamId, String strippedChannel, String sourceIdentity)
      Allocated a recording position counter and populate the metadata.
      Parameters:
      aeron - on which the counter will be registered.
      tempBuffer - for encoding the metadata.
      archiveId - to which the counter belongs.
      recordingId - for the recording.
      sessionId - for the publication being recorded.
      streamId - for the publication being recorded.
      strippedChannel - for the recording subscription.
      sourceIdentity - for the publication.
      Returns:
      the allocated counter.
    • findCounterIdByRecording

      @Deprecated public static int findCounterIdByRecording(CountersReader countersReader, long recordingId)
      Find the active counter id for a stream based on the recording id.
      Parameters:
      countersReader - to search within.
      recordingId - for the active recording.
      Returns:
      the counter id if found otherwise CountersReader.NULL_COUNTER_ID.
    • findCounterIdByRecording

      public static int findCounterIdByRecording(CountersReader countersReader, long recordingId, long archiveId)
      Find the active counter id for a stream based on the recording id and archive id.
      Parameters:
      countersReader - to search within.
      recordingId - for the active recording.
      archiveId - to target specific Archive. Use Aeron.NULL_VALUE to emulate old behavior.
      Returns:
      the counter id if found otherwise CountersReader.NULL_COUNTER_ID.
      Since:
      1.44.0
    • findCounterIdBySession

      @Deprecated public static int findCounterIdBySession(CountersReader countersReader, int sessionId)
      Find the active counter id for a stream based on the session id.
      Parameters:
      countersReader - to search within.
      sessionId - for the active recording.
      Returns:
      the counter id if found otherwise CountersReader.NULL_COUNTER_ID.
    • findCounterIdBySession

      public static int findCounterIdBySession(CountersReader countersReader, int sessionId, long archiveId)
      Find the active counter id for a stream based on the session id and archive id.
      Parameters:
      countersReader - to search within.
      sessionId - for the active recording.
      archiveId - to target specific Archive. Use Aeron.NULL_VALUE to emulate old behavior.
      Returns:
      the counter id if found otherwise CountersReader.NULL_COUNTER_ID.
      Since:
      1.44.0
    • getRecordingId

      public static long getRecordingId(CountersReader countersReader, int counterId)
      Get the recording id for a given counter id.
      Parameters:
      countersReader - to search within.
      counterId - for the active recording.
      Returns:
      the counter id if found otherwise NULL_RECORDING_ID.
    • getSourceIdentity

      public static String getSourceIdentity(CountersReader counters, int counterId)
      Get the Image.sourceIdentity() for the recording.
      Parameters:
      counters - to search within.
      counterId - for the active recording.
      Returns:
      Image.sourceIdentity() for the recording or null if not found.
    • isActive

      public static boolean isActive(CountersReader counters, int counterId, long recordingId)
      Is the recording counter still active.
      Parameters:
      counters - to search within.
      counterId - to search for.
      recordingId - to confirm it is still the same value.
      Returns:
      true if the counter is still active otherwise false.