Class IndexUtils

java.lang.Object
io.fluxcapacitor.javaclient.tracking.IndexUtils

public class IndexUtils extends Object
Use 48 bits of the current time in milliseconds since epoch as the base of the index. The remaining 16 bits (65k) are used to increment the index if messages are written in the same ms as the last batch.

The index is only able to store 2^47 - 1 ms of time since epoch, i.e. about 4,500 years.

Uses FluxCapacitor.currentClock() to get the index corresponding to the current timestamp of Flux Capacitor's internal clock.

  • Constructor Details

    • IndexUtils

      public IndexUtils()
  • Method Details

    • millisFromIndex

      public static long millisFromIndex(long index)
    • timestampFromIndex

      public static Instant timestampFromIndex(long index)
    • indexFromTimestamp

      public static long indexFromTimestamp(Instant timestamp)
    • indexFromMillis

      public static long indexFromMillis(long millisSinceEpoch)
    • offsetFromIndex

      public static int offsetFromIndex(long index)
    • indexForCurrentTime

      public static long indexForCurrentTime()