Package com.illumon.iris.db.v2.locations
Class TableLocationStateHolder
java.lang.Object
com.illumon.iris.db.v2.locations.TableLocationStateHolder
- All Implemented Interfaces:
TableLocationState
- Direct Known Subclasses:
CheckpointRecord
public class TableLocationStateHolder extends Object implements TableLocationState
Tool for generic multi-field "atomic" get/set of state values for a table location.
NB: Possibly-concurrent usages should be externally synchronized.
-
Field Summary
Fields inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
NULL_SIZE, NULL_TIME, REMOVE_SIZE
-
Constructor Summary
Constructors Modifier Constructor Description protected
TableLocationStateHolder()
-
Method Summary
Modifier and Type Method Description protected void
clearValues()
Clear this holder, by reinitializing all fields to their "null" equivalents.long
getLastModifiedTimeMillis()
long
getSize()
Object
getStateLock()
boolean
readValuesFrom(DataInput input)
Read all values from the supplied input into this state holder.boolean
setValues(long size, long lastModifiedTimeMillis)
Set all state values.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
copyStateValuesTo, getSizeStr, writeStateValuesTo
-
Constructor Details
-
TableLocationStateHolder
protected TableLocationStateHolder()
-
-
Method Details
-
getStateLock
- Specified by:
getStateLock
in interfaceTableLocationState
- Returns:
- The Object that accessors should synchronize on if they want to invoke multiple getters with consistent results.
-
getSize
public final long getSize()- Specified by:
getSize
in interfaceTableLocationState
- Returns:
- The size of a table location:
NULL_SIZE : Size information is unknown or does not exist for this table location
>= 0 : The table location exists and has (possibly empty) data
-
getLastModifiedTimeMillis
public final long getLastModifiedTimeMillis()- Specified by:
getLastModifiedTimeMillis
in interfaceTableLocationState
- Returns:
- The last modified time for a table location, in milliseconds from the epoch:
NULL_TIME : Modification time information is unknown or does not exist for this table location
>= 0L : The time this table was last modified, in milliseconds from the UTC epoch
-
clearValues
protected final void clearValues()Clear this holder, by reinitializing all fields to their "null" equivalents. -
setValues
public final boolean setValues(long size, long lastModifiedTimeMillis)Set all state values.- Parameters:
size
- The new sizelastModifiedTimeMillis
- The new modification time- Returns:
- Whether any of the values changed
-
readValuesFrom
Read all values from the supplied input into this state holder.- Parameters:
input
- A input to read from- Returns:
- Whether any of the values changed
- Throws:
IOException
-