Class ArchiveCounters

java.lang.Object
io.aeron.archive.ArchiveCounters

public final class ArchiveCounters extends Object
For allocating and finding Archive associated counters identified by the Aeron.clientId().
  • Method Details

    • allocate

      public static Counter allocate(Aeron aeron, MutableDirectBuffer tempBuffer, int typeId, String name, long archiveId)
      Allocate a counter to represent state within an Archive. The archiveId is assumed to be Aeron.clientId().
      Parameters:
      aeron - from Archive instance to allocate the counter.
      tempBuffer - temporary storage to create label and metadata.
      typeId - for the counter.
      name - of the counter for the label.
      archiveId - to which the allocated counter belongs.
      Returns:
      the Counter for the commit position.
    • appendArchiveIdLabel

      public static int appendArchiveIdLabel(MutableDirectBuffer tempBuffer, int offset, long archiveId)
      Append archiveId at the end of the counter label.
      Parameters:
      tempBuffer - to append label to.
      offset - at which current label data ends.
      archiveId - to use as suffix.
      Returns:
      length of the suffix appended.
    • lengthOfArchiveIdLabel

      public static int lengthOfArchiveIdLabel(long archiveId)
      Returns the length of the archive id suffix in bytes.
      Parameters:
      archiveId - that will be added to the label.
      Returns:
      the length of the archive id suffix in bytes.
    • find

      public static int find(CountersReader counters, int typeId, long archiveId)
      Find the counter id for a type of counter in an Archive.
      Parameters:
      counters - to search within.
      typeId - of the counter.
      archiveId - to which the allocated counter belongs.
      Returns:
      the matching counter id or Aeron.NULL_VALUE if not found.