Package org.rostore
Class Utils
java.lang.Object
org.rostore.Utils
General functions and constants used in rostore modules.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final longstatic final longstatic final longstatic final longstatic final Charsetstatic final longstatic final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcomputeBytesForMaxValue(long maxValue) Computes how many bytes is needed to represent the valuestatic final longeol2ttl(long eol) static final longeol2unix(long eol) static byte[]static final booleanisExpiredEOL(long eol) static final booleanisExpiredEOL(long eol, long currentTimeSecs) static longtrimByBytes(long value, int bytes) static final longttl2eol(long ttl) Converts the time-to-live to end-of-live timestatic final longttl2unixEol(long ttl) static longunixEol2eol(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)
-