Class LocalAppendableColumn<DATA_TYPE>
- All Implemented Interfaces:
AppendableColumn<DATA_TYPE>,BufferedAppendable,BufferedAppendableColumn<DATA_TYPE>,TableTransactionProcessor
- Direct Known Subclasses:
FixedWidthObjectCodecLocalAppendableColumn,NanosBackedTimeAppendableColumn,SymbolManagerLocalAppendableColumn,VariableWidthObjectLocalAppendableColumn
public class LocalAppendableColumn<DATA_TYPE> extends BaseAppendableColumn<DATA_TYPE> implements TableTransactionProcessor, BufferedAppendableColumn<DATA_TYPE>
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 Modifier and Type Class Description static interfaceLocalAppendableColumn.ValueSupplier<DATA_TYPE> -
Field Summary
Fields inherited from interface com.illumon.iris.db.tables.appendable.AppendableColumn
DEFAULT_CHUNK_CAPACITY -
Method Summary
Modifier and Type Method Description voidabortTransaction()Abort the current pending transaction.voidaddByte(byte value)Append a byte to this column.voidaddByte(byte value, long count)Append a byte to this columncounttimes.voidaddBytes(byte[] values, int startIndex, int length)Add byte values from an array.voidaddBytes(ByteBuffer inputBuffer)Add byte values from a ByteBuffer, starting at buffer.position() and continuing to buffer.limit().voidaddChar(char value)Append a char to this column.voidaddChar(char value, long count)Append a char to this columncounttimes.voidaddChars(char[] values, int startIndex, int length)Add char values from an array.voidaddComputed(int count, LocalAppendableColumn.ValueSupplier<DATA_TYPE> valueSupplier)Add values computed on demand from a function over an int value index.voidaddDouble(double value)Append a double to this column.voidaddDouble(double value, long count)Append a double to this columncounttimes.voidaddDoubles(double[] values, int startIndex, int length)Add double values from an array.voidaddEncoded(int count, IntFunction<ByteBuffer> valueSupplier)Add pre-encoded values computed on demand from a function over an int value index.voidaddFloat(float value)Append a float to this column.voidaddFloat(float value, long count)Append a float to this columncounttimes.voidaddFloats(float[] values, int startIndex, int length)Add float values from an array.voidaddFromBooleanChunk(ObjectChunk<Boolean,? extends Attributes.Values> source)Add all values fromsourcein the range[0, source.size()).voidaddFromByteChunk(ByteChunk<? extends Attributes.Values> source)Add all values fromsourcein the range[0, source.size()).voidaddFromCharChunk(CharChunk<? extends Attributes.Values> source)Add all values fromsourcein the range[0, source.size()).voidaddFromDoubleChunk(DoubleChunk<? extends Attributes.Values> source)Add all values fromsourcein the range[0, source.size()).voidaddFromFloatChunk(FloatChunk<? extends Attributes.Values> source)Add all values fromsourcein the range[0, source.size()).voidaddFromIntChunk(IntChunk<? extends Attributes.Values> source)Add all values fromsourcein the range[0, source.size()).voidaddFromLongChunk(LongChunk<? extends Attributes.Values> source)Add all values fromsourcein the range[0, source.size()).voidaddFromObjectChunk(ObjectChunk<DATA_TYPE,? extends Attributes.Values> source)Add all values fromsourcein the range[0, source.size()).voidaddFromShortChunk(ShortChunk<? extends Attributes.Values> source)Add all values fromsourcein the range[0, source.size()).voidaddInt(int value)Append a int to this column.voidaddInt(int value, long count)Append a int to this columncounttimes.voidaddInts(int[] values, int startIndex, int length)Add int values from an array.voidaddLong(long value)Append a long to this column.voidaddLong(long value, long count)Append a long to this columncounttimes.voidaddLongs(long[] values, int startIndex, int length)Add long values from an array.voidaddShort(short value)Append a short to this column.voidaddShort(short value, long count)Append a short to this columncounttimes.voidaddShorts(short[] values, int startIndex, int length)Add short values from an array.voidclose()Flush all appended data to the underlying store, release any resources held, and force all appended data to be persisted to permanent storage.voiddoneAppending()Optionally called beforeBufferedAppendable.close()to release any resources that may be released prior toBufferedAppendable.close().voidfinishTransaction()Finish the current pending transaction.voidflush()Write all appended data to the underlying store and prepare for subsequent writes.voidforce()Force all flushed data to be persisted to permanent storage.booleaninTransaction()voidrelease()Release any resources held.voidstartTransaction()Begin a new transaction.StringtoString()Methods inherited from class com.illumon.iris.db.tables.appendable.BaseAppendableColumn
add, add, add, addBoolean, addBoolean, addBooleans, checkArrayAddBounds, encodeExternalizable, encodeSerializable, getAddHelper, getName, getTypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, getTypeMethods inherited from interface com.illumon.iris.db.tables.appendable.BufferedAppendable
maybeForce, prepareCheckpoint
-
Method Details
-
toString
-
force
public void force()Description copied from interface:BufferedAppendableForce 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:
forcein interfaceAppendableColumn<DATA_TYPE>- Specified by:
forcein interfaceBufferedAppendable
-
close
public void close()Description copied from interface:BufferedAppendableFlush 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:
closein interfaceAppendableColumn<DATA_TYPE>- Specified by:
closein interfaceBufferedAppendable
-
flush
public void flush()Description copied from interface:BufferedAppendableWrite all appended data to the underlying store and prepare for subsequent writes. Does not implyBufferedAppendable.force().- Specified by:
flushin interfaceBufferedAppendable
-
doneAppending
public void doneAppending()Description copied from interface:BufferedAppendableColumnOptionally 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:
doneAppendingin interfaceBufferedAppendableColumn<DATA_TYPE>
-
release
public void release()Description copied from interface:BufferedAppendableRelease 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:
releasein interfaceBufferedAppendable
-
inTransaction
public boolean inTransaction()- Specified by:
inTransactionin interfaceTableTransactionProcessor- Returns:
- True if this processor is currently in a transaction, else false
-
startTransaction
public void startTransaction()Description copied from interface:TableTransactionProcessorBegin a new transaction. Causes any existing pending transaction to be aborted.- Specified by:
startTransactionin interfaceTableTransactionProcessor
-
abortTransaction
public void abortTransaction()Description copied from interface:TableTransactionProcessorAbort the current pending transaction.
This should not be called if there is no current transaction.
- Specified by:
abortTransactionin interfaceTableTransactionProcessor
-
finishTransaction
public void finishTransaction()Description copied from interface:TableTransactionProcessorFinish 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:
finishTransactionin interfaceTableTransactionProcessor
-
addByte
public void addByte(byte value)Description copied from interface:AppendableColumnAppend a byte to this column.- Specified by:
addBytein interfaceAppendableColumn<DATA_TYPE>- Parameters:
value- The value to append
-
addChar
public void addChar(char value)Description copied from interface:AppendableColumnAppend a char to this column.- Specified by:
addCharin interfaceAppendableColumn<DATA_TYPE>- Parameters:
value- The value to append
-
addDouble
public void addDouble(double value)Description copied from interface:AppendableColumnAppend a double to this column.- Specified by:
addDoublein interfaceAppendableColumn<DATA_TYPE>- Parameters:
value- The value to append
-
addFloat
public void addFloat(float value)Description copied from interface:AppendableColumnAppend a float to this column.- Specified by:
addFloatin interfaceAppendableColumn<DATA_TYPE>- Parameters:
value- The value to append
-
addInt
public void addInt(int value)Description copied from interface:AppendableColumnAppend a int to this column.- Specified by:
addIntin interfaceAppendableColumn<DATA_TYPE>- Parameters:
value- The value to append
-
addLong
public void addLong(long value)Description copied from interface:AppendableColumnAppend a long to this column.- Specified by:
addLongin interfaceAppendableColumn<DATA_TYPE>- Parameters:
value- The value to append
-
addShort
public void addShort(short value)Description copied from interface:AppendableColumnAppend a short to this column.- Specified by:
addShortin interfaceAppendableColumn<DATA_TYPE>- Parameters:
value- The value to append
-
addByte
public final void addByte(byte value, long count)Description copied from interface:AppendableColumnAppend a byte to this columncounttimes.- Specified by:
addBytein 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:AppendableColumnAppend a char to this columncounttimes.- Specified by:
addCharin 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:AppendableColumnAppend a double to this columncounttimes.- Specified by:
addDoublein 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:AppendableColumnAppend a float to this columncounttimes.- Specified by:
addFloatin 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:AppendableColumnAppend a int to this columncounttimes.- Specified by:
addIntin 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:AppendableColumnAppend a long to this columncounttimes.- Specified by:
addLongin 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:AppendableColumnAppend a short to this columncounttimes.- Specified by:
addShortin 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:AppendableColumnAdd byte values from an array.- Specified by:
addBytesin 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:AppendableColumnAdd byte values from a ByteBuffer, starting at buffer.position() and continuing to buffer.limit().- Specified by:
addBytesin interfaceAppendableColumn<DATA_TYPE>- Parameters:
inputBuffer- The buffer
-
addChars
public void addChars(@NotNull char[] values, int startIndex, int length)Description copied from interface:AppendableColumnAdd char values from an array.- Specified by:
addCharsin 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:AppendableColumnAdd double values from an array.- Specified by:
addDoublesin 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:AppendableColumnAdd float values from an array.- Specified by:
addFloatsin 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:AppendableColumnAdd int values from an array.- Specified by:
addIntsin 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:AppendableColumnAdd long values from an array.- Specified by:
addLongsin 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:AppendableColumnAdd short values from an array.- Specified by:
addShortsin interfaceAppendableColumn<DATA_TYPE>- Parameters:
values- The array of valuesstartIndex- The index of the first value to addlength- The total number of values to add
-
addComputed
public void addComputed(int count, @NotNull LocalAppendableColumn.ValueSupplier<DATA_TYPE> valueSupplier) throws IOExceptionAdd 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:AppendableColumnAdd all values fromsourcein the range[0, source.size()).- Specified by:
addFromBooleanChunkin interfaceAppendableColumn<DATA_TYPE>- Parameters:
source- The sourceObjectChunk
-
addFromByteChunk
Description copied from interface:AppendableColumnAdd all values fromsourcein the range[0, source.size()).- Specified by:
addFromByteChunkin interfaceAppendableColumn<DATA_TYPE>- Parameters:
source- The sourceByteChunk
-
addFromCharChunk
Description copied from interface:AppendableColumnAdd all values fromsourcein the range[0, source.size()).- Specified by:
addFromCharChunkin interfaceAppendableColumn<DATA_TYPE>- Parameters:
source- The sourceCharChunk
-
addFromDoubleChunk
Description copied from interface:AppendableColumnAdd all values fromsourcein the range[0, source.size()).- Specified by:
addFromDoubleChunkin interfaceAppendableColumn<DATA_TYPE>- Parameters:
source- The sourceDoubleChunk
-
addFromFloatChunk
Description copied from interface:AppendableColumnAdd all values fromsourcein the range[0, source.size()).- Specified by:
addFromFloatChunkin interfaceAppendableColumn<DATA_TYPE>- Parameters:
source- The sourceFloatChunk
-
addFromIntChunk
Description copied from interface:AppendableColumnAdd all values fromsourcein the range[0, source.size()).- Specified by:
addFromIntChunkin interfaceAppendableColumn<DATA_TYPE>- Parameters:
source- The sourceIntChunk
-
addFromLongChunk
Description copied from interface:AppendableColumnAdd all values fromsourcein the range[0, source.size()).- Specified by:
addFromLongChunkin interfaceAppendableColumn<DATA_TYPE>- Parameters:
source- The sourceLongChunk
-
addFromShortChunk
Description copied from interface:AppendableColumnAdd all values fromsourcein the range[0, source.size()).- Specified by:
addFromShortChunkin interfaceAppendableColumn<DATA_TYPE>- Parameters:
source- The sourceShortChunk
-
addFromObjectChunk
public final void addFromObjectChunk(@NotNull ObjectChunk<DATA_TYPE,? extends Attributes.Values> source)Description copied from interface:AppendableColumnAdd all values fromsourcein the range[0, source.size()).- Specified by:
addFromObjectChunkin interfaceAppendableColumn<DATA_TYPE>- Parameters:
source- The sourceObjectChunk
-