Package org.rostore
Class Utils
java.lang.Object
org.rostore.Utils
General functions and constants used in rostore modules.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final long
static final long
static final long
static final long
static final Charset
static final long
static final long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
computeBytesForMaxValue
(long maxValue) Computes how many bytes is needed to represent the valuestatic final long
eol2ttl
(long eol) static final long
eol2unix
(long eol) static byte[]
static final boolean
isExpiredEOL
(long eol) static final boolean
isExpiredEOL
(long eol, long currentTimeSecs) static long
trimByBytes
(long value, int bytes) static final long
ttl2eol
(long ttl) Converts the time-to-live to end-of-live timestatic final long
ttl2unixEol
(long ttl) static long
unixEol2eol
(long unixEol)
-
Field Details
-
UTF_8
-
BYTES_PER_EOL
public static final int BYTES_PER_EOL- See Also:
-
BYTES_PER_VERSION
public static final int BYTES_PER_VERSION- See Also:
-
TTL_FOREVER
public static final long TTL_FOREVER- See Also:
-
TTL_EXPIRED
public static final long TTL_EXPIRED- See Also:
-
EOL_FOREVER
public static final long EOL_FOREVER- See Also:
-
VERSION_UNDEFINED
public static final long VERSION_UNDEFINED- See Also:
-
VERSION_START
public static final long VERSION_START- See Also:
-
ID_UNDEFINED
public static final long ID_UNDEFINED- See Also:
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
getBytes
-
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 fromTTL_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)
-