Class LocalAppendableColumn<DATA_TYPE>
- All Implemented Interfaces:
AppendableColumn<DATA_TYPE>
,BufferedAppendable
,BufferedAppendableColumn<DATA_TYPE>
,TableTransactionProcessor
- Direct Known Subclasses:
FixedWidthObjectCodecLocalAppendableColumn
,NanosBackedTimeAppendableColumn
,SymbolManagerLocalAppendableColumn
,VariableWidthObjectLocalAppendableColumn
AppendableColumn for output to a local column location.
Application threads must synchronize in order to ensure mutually-exclusive concurrent access for all operations
other than force()
(which may proceed concurrently).
release()
or close()
must only be called after all other operations besides force()
are
completed, in any thread. The expectation is that after an error in writing applications will release()
scarce resources, or after successful writing applications will close()
the column.
Note that code assumes correct usage, and omits validation for alignment issues that would occur with incorrect usage.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class com.illumon.iris.db.tables.appendable.BaseAppendableColumn
name, type
Fields inherited from interface com.illumon.iris.db.tables.appendable.AppendableColumn
DEFAULT_CHUNK_CAPACITY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort the current pending transaction.void
addByte
(byte value) Append a byte to this column.final void
addByte
(byte value, long count) Append a byte to this columncount
times.void
addBytes
(byte[] values, int startIndex, int length) Add byte values from an array.void
addBytes
(ByteBuffer inputBuffer) Add byte values from a ByteBuffer, starting at buffer.position() and continuing to buffer.limit().void
addChar
(char value) Append a char to this column.final void
addChar
(char value, long count) Append a char to this columncount
times.void
addChars
(char[] values, int startIndex, int length) Add char values from an array.void
addComputed
(int count, LocalAppendableColumn.ValueSupplier<DATA_TYPE> valueSupplier) Add values computed on demand from a function over an int value index.void
addDouble
(double value) Append a double to this column.final void
addDouble
(double value, long count) Append a double to this columncount
times.void
addDoubles
(double[] values, int startIndex, int length) Add double values from an array.void
addEncoded
(int count, IntFunction<ByteBuffer> valueSupplier) Add pre-encoded values computed on demand from a function over an int value index.void
addFloat
(float value) Append a float to this column.final void
addFloat
(float value, long count) Append a float to this columncount
times.void
addFloats
(float[] values, int startIndex, int length) Add float values from an array.final void
addFromBooleanChunk
(ObjectChunk<Boolean, ? extends Attributes.Values> source) Add all values fromsource
in the range[0, source.size())
.final void
addFromByteChunk
(ByteChunk<? extends Attributes.Values> source) Add all values fromsource
in the range[0, source.size())
.final void
addFromCharChunk
(CharChunk<? extends Attributes.Values> source) Add all values fromsource
in the range[0, source.size())
.final void
addFromDoubleChunk
(DoubleChunk<? extends Attributes.Values> source) Add all values fromsource
in the range[0, source.size())
.final void
addFromFloatChunk
(FloatChunk<? extends Attributes.Values> source) Add all values fromsource
in the range[0, source.size())
.final void
addFromIntChunk
(IntChunk<? extends Attributes.Values> source) Add all values fromsource
in the range[0, source.size())
.final void
addFromLongChunk
(LongChunk<? extends Attributes.Values> source) Add all values fromsource
in the range[0, source.size())
.final void
addFromObjectChunk
(ObjectChunk<DATA_TYPE, ? extends Attributes.Values> source) Add all values fromsource
in the range[0, source.size())
.final void
addFromShortChunk
(ShortChunk<? extends Attributes.Values> source) Add all values fromsource
in the range[0, source.size())
.void
addInt
(int value) Append a int to this column.final void
addInt
(int value, long count) Append a int to this columncount
times.void
addInts
(int[] values, int startIndex, int length) Add int values from an array.void
addLong
(long value) Append a long to this column.final void
addLong
(long value, long count) Append a long to this columncount
times.void
addLongs
(long[] values, int startIndex, int length) Add long values from an array.void
addShort
(short value) Append a short to this column.final void
addShort
(short value, long count) Append a short to this columncount
times.void
addShorts
(short[] values, int startIndex, int length) Add short values from an array.void
close()
Flush all appended data to the underlying store, release any resources held, and force all appended data to be persisted to permanent storage.void
Optionally called beforeBufferedAppendable.close()
to release any resources that may be released prior toBufferedAppendable.close()
.void
When recreating our files, we need to make sure that they exist, but we do not need to actually force them to disk durably.void
Finish the current pending transaction.void
flush()
Write all appended data to the underlying store and prepare for subsequent writes.void
force()
Force all flushed data to be persisted to permanent storage.boolean
void
release()
Release any resources held.void
Begin a new transaction.toString()
Methods inherited from class com.illumon.iris.db.tables.appendable.BaseAppendableColumn
add, add, add, addBoolean, addBoolean, addBooleans, checkArrayAddBounds, encodeExternalizable, encodeSerializable, getAddHelper, getName, getType
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.tables.appendable.AppendableColumn
add, add, add, addBoolean, addBoolean, addBooleans, addFromArray, addFromBoxedValue, addFromBoxedValue, addFromChunk, addFromChunkSource, addFromChunkSource, addFromChunkSource, addFromColumnSource, addFromColumnSource, addFromColumnSource, addFromColumnSource, addFromDataColumn, getAddHelper, getName, getType
Methods inherited from interface com.illumon.iris.db.tables.appendable.BufferedAppendable
maybeForce, prepareCheckpoint
-
Method Details
-
toString
-
force
public void force()Description copied from interface:BufferedAppendable
Force all flushed data to be persisted to permanent storage. Will consistently and atomically persist the last prepared checkpoint in implementations that implementBufferedAppendable.prepareCheckpoint()
. Does not implyBufferedAppendable.flush()
, as this is a distinct operation in all implementations. May be called concurrently by threads other than the "writing thread".- Specified by:
force
in interfaceAppendableColumn<DATA_TYPE>
- Specified by:
force
in interfaceBufferedAppendable
-
close
public void close()Description copied from interface:BufferedAppendable
Flush all appended data to the underlying store, release any resources held, and force all appended data to be persisted to permanent storage. This should be the final access to this appendable (if successful) with the exception of any asynchronousBufferedAppendable.force()
operations. ABufferedAppendable.release()
is appropriate afterwards, especially on error.- Specified by:
close
in interfaceAppendableColumn<DATA_TYPE>
- Specified by:
close
in interfaceBufferedAppendable
-
flush
public void flush()Description copied from interface:BufferedAppendable
Write all appended data to the underlying store and prepare for subsequent writes. Does not implyBufferedAppendable.force()
.- Specified by:
flush
in interfaceBufferedAppendable
-
doneAppending
public void doneAppending()Description copied from interface:BufferedAppendableColumn
Optionally called beforeBufferedAppendable.close()
to release any resources that may be released prior toBufferedAppendable.close()
. No data should be appended after this method is invoked.- Specified by:
doneAppending
in interfaceBufferedAppendableColumn<DATA_TYPE>
-
release
public void release()Description copied from interface:BufferedAppendable
Release any resources held. Called after an error in preparation for termination. For external callers, this should be done as the final access to this column with the exception of any asynchronousBufferedAppendable.force()
operations.- Specified by:
release
in interfaceBufferedAppendable
-
inTransaction
public boolean inTransaction()- Specified by:
inTransaction
in interfaceTableTransactionProcessor
- Returns:
- True if this processor is currently in a transaction, else false
-
startTransaction
public void startTransaction()Description copied from interface:TableTransactionProcessor
Begin a new transaction. Causes any existing pending transaction to be aborted.- Specified by:
startTransaction
in interfaceTableTransactionProcessor
-
abortTransaction
public void abortTransaction()Description copied from interface:TableTransactionProcessor
Abort the current pending transaction.
This should not be called if there is no current transaction.
- Specified by:
abortTransaction
in interfaceTableTransactionProcessor
-
finishTransaction
public void finishTransaction()Description copied from interface:TableTransactionProcessor
Finish the current pending transaction.
This makes the rows that were part of the transaction eligible to be made visible and durable, but does not in itself make them visible or durable.
This should not be called if there is no current transaction.
- Specified by:
finishTransaction
in interfaceTableTransactionProcessor
-
addByte
public void addByte(byte value) Description copied from interface:AppendableColumn
Append a byte to this column.- Specified by:
addByte
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to append
-
addChar
public void addChar(char value) Description copied from interface:AppendableColumn
Append a char to this column.- Specified by:
addChar
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to append
-
addDouble
public void addDouble(double value) Description copied from interface:AppendableColumn
Append a double to this column.- Specified by:
addDouble
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to append
-
addFloat
public void addFloat(float value) Description copied from interface:AppendableColumn
Append a float to this column.- Specified by:
addFloat
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to append
-
addInt
public void addInt(int value) Description copied from interface:AppendableColumn
Append a int to this column.- Specified by:
addInt
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to append
-
addLong
public void addLong(long value) Description copied from interface:AppendableColumn
Append a long to this column.- Specified by:
addLong
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to append
-
addShort
public void addShort(short value) Description copied from interface:AppendableColumn
Append a short to this column.- Specified by:
addShort
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to append
-
addByte
public final void addByte(byte value, long count) Description copied from interface:AppendableColumn
Append a byte to this columncount
times.- Specified by:
addByte
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to appendcount
- The number of times to append the value
-
addChar
public final void addChar(char value, long count) Description copied from interface:AppendableColumn
Append a char to this columncount
times.- Specified by:
addChar
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to appendcount
- The number of times to append the value
-
addDouble
public final void addDouble(double value, long count) Description copied from interface:AppendableColumn
Append a double to this columncount
times.- Specified by:
addDouble
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to appendcount
- The number of times to append the value
-
addFloat
public final void addFloat(float value, long count) Description copied from interface:AppendableColumn
Append a float to this columncount
times.- Specified by:
addFloat
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to appendcount
- The number of times to append the value
-
addInt
public final void addInt(int value, long count) Description copied from interface:AppendableColumn
Append a int to this columncount
times.- Specified by:
addInt
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to appendcount
- The number of times to append the value
-
addLong
public final void addLong(long value, long count) Description copied from interface:AppendableColumn
Append a long to this columncount
times.- Specified by:
addLong
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to appendcount
- The number of times to append the value
-
addShort
public final void addShort(short value, long count) Description copied from interface:AppendableColumn
Append a short to this columncount
times.- Specified by:
addShort
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
value
- The value to appendcount
- The number of times to append the value
-
addBytes
public void addBytes(@NotNull byte[] values, int startIndex, int length) Description copied from interface:AppendableColumn
Add byte values from an array.- Specified by:
addBytes
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to add
-
addBytes
Description copied from interface:AppendableColumn
Add byte values from a ByteBuffer, starting at buffer.position() and continuing to buffer.limit().- Specified by:
addBytes
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
inputBuffer
- The buffer
-
addChars
public void addChars(@NotNull char[] values, int startIndex, int length) Description copied from interface:AppendableColumn
Add char values from an array.- Specified by:
addChars
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to add
-
addDoubles
public void addDoubles(@NotNull double[] values, int startIndex, int length) Description copied from interface:AppendableColumn
Add double values from an array.- Specified by:
addDoubles
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to add
-
addFloats
public void addFloats(@NotNull float[] values, int startIndex, int length) Description copied from interface:AppendableColumn
Add float values from an array.- Specified by:
addFloats
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to add
-
addInts
public void addInts(@NotNull int[] values, int startIndex, int length) Description copied from interface:AppendableColumn
Add int values from an array.- Specified by:
addInts
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to add
-
addLongs
public void addLongs(@NotNull long[] values, int startIndex, int length) Description copied from interface:AppendableColumn
Add long values from an array.- Specified by:
addLongs
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to add
-
addShorts
public void addShorts(@NotNull short[] values, int startIndex, int length) Description copied from interface:AppendableColumn
Add short values from an array.- Specified by:
addShorts
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to add
-
ensureFileExists
public void ensureFileExists()When recreating our files, we need to make sure that they exist, but we do not need to actually force them to disk durably. -
addComputed
public void addComputed(int count, @NotNull LocalAppendableColumn.ValueSupplier<DATA_TYPE> valueSupplier) throws IOException Add values computed on demand from a function over an int value index. Note that this is generally sub-optimal for columns of primitive types.- Parameters:
count
- The number of values to addvalueSupplier
- The value supplier, over domain[0, length)
- Throws:
IOException
-
addEncoded
Add pre-encoded values computed on demand from a function over an int value index. The caller is responsible for ensuring that the encoding is correct.- Parameters:
count
- The number of values to addvalueSupplier
- The value supplier, over domain[0, length)
-
addFromBooleanChunk
public final void addFromBooleanChunk(@NotNull ObjectChunk<Boolean, ? extends Attributes.Values> source) Description copied from interface:AppendableColumn
Add all values fromsource
in the range[0, source.size())
.- Specified by:
addFromBooleanChunk
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
source
- The sourceObjectChunk
-
addFromByteChunk
Description copied from interface:AppendableColumn
Add all values fromsource
in the range[0, source.size())
.- Specified by:
addFromByteChunk
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
source
- The sourceByteChunk
-
addFromCharChunk
Description copied from interface:AppendableColumn
Add all values fromsource
in the range[0, source.size())
.- Specified by:
addFromCharChunk
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
source
- The sourceCharChunk
-
addFromDoubleChunk
Description copied from interface:AppendableColumn
Add all values fromsource
in the range[0, source.size())
.- Specified by:
addFromDoubleChunk
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
source
- The sourceDoubleChunk
-
addFromFloatChunk
Description copied from interface:AppendableColumn
Add all values fromsource
in the range[0, source.size())
.- Specified by:
addFromFloatChunk
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
source
- The sourceFloatChunk
-
addFromIntChunk
Description copied from interface:AppendableColumn
Add all values fromsource
in the range[0, source.size())
.- Specified by:
addFromIntChunk
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
source
- The sourceIntChunk
-
addFromLongChunk
Description copied from interface:AppendableColumn
Add all values fromsource
in the range[0, source.size())
.- Specified by:
addFromLongChunk
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
source
- The sourceLongChunk
-
addFromShortChunk
Description copied from interface:AppendableColumn
Add all values fromsource
in the range[0, source.size())
.- Specified by:
addFromShortChunk
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
source
- The sourceShortChunk
-
addFromObjectChunk
public final void addFromObjectChunk(@NotNull ObjectChunk<DATA_TYPE, ? extends Attributes.Values> source) Description copied from interface:AppendableColumn
Add all values fromsource
in the range[0, source.size())
.- Specified by:
addFromObjectChunk
in interfaceAppendableColumn<DATA_TYPE>
- Parameters:
source
- The sourceObjectChunk
-