Package org.rostore

Class Utils

java.lang.Object
org.rostore.Utils

public class Utils extends Object
General functions and constants used in rostore modules.
  • Field Details

  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • getBytes

      public static byte[] getBytes(String str)
    • ttl2eol

      public static final long ttl2eol(long ttl)
      Converts the time-to-live to end-of-live time
      Parameters:
      ttl - in seconds
      Returns:
      eol
    • ttl2unixEol

      public static final long ttl2unixEol(long ttl)
    • eol2ttl

      public static final long eol2ttl(long eol)
      Parameters:
      eol - unix time in seconds starting from TTL_START
      Returns:
      ttl in seconds
    • eol2unix

      public static final long eol2unix(long eol)
    • isExpiredEOL

      public static final boolean isExpiredEOL(long eol)
    • isExpiredEOL

      public static final boolean isExpiredEOL(long eol, long currentTimeSecs)
    • computeBytesForMaxValue

      public static int computeBytesForMaxValue(long maxValue)
      Computes how many bytes is needed to represent the value
      Parameters:
      maxValue - the value can only be in range 0..maxValue
      Returns:
    • trimByBytes

      public static long trimByBytes(long value, int bytes)
    • unixEol2eol

      public static long unixEol2eol(long unixEol)