Class IndexUtils

java.lang.Object
io.fluxcapacitor.common.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.

  • Field Details

  • Constructor Details

    • IndexUtils

      public IndexUtils()
  • Method Details

    • currentTime

      public static Instant currentTime()
    • currentTimeMillis

      public static long currentTimeMillis()
    • 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)
    • indexForCurrentTime

      public static long indexForCurrentTime()
    • offsetFromIndex

      public static int offsetFromIndex​(long index)