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 LocalAppendableColumn.force()
(which may proceed concurrently).
LocalAppendableColumn.release()
or LocalAppendableColumn.close()
must only be called after all other operations besides LocalAppendableColumn.force()
are
completed, in any thread. The expectation is that after an error in writing applications will LocalAppendableColumn.release()
scarce resources, or after successful writing applications will LocalAppendableColumn.close()
the column.
Note that code assumes correct usage, and omits validation for alignment issues that would occur with incorrect usage.
name, type
Modifier and Type | Method and Description |
---|---|
void |
abortTransaction()
Abort the current pending transaction.
|
void |
addByte(byte value)
Append a byte to this column.
|
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.
|
void |
addChars(char[] values,
int startIndex,
int length)
Add char values from an array.
|
void |
addDouble(double value)
Append a double to this column.
|
void |
addDoubles(double[] values,
int startIndex,
int length)
Add double values from an array.
|
void |
addFloat(float value)
Append a float to this column.
|
void |
addFloats(float[] values,
int startIndex,
int length)
Add float values from an array.
|
void |
addInt(int value)
Append a int to this column.
|
void |
addInts(int[] values,
int startIndex,
int length)
Add int values from an array.
|
void |
addLong(long value)
Append a long to this column.
|
void |
addLongs(long[] values,
int startIndex,
int length)
Add long values from an array.
|
void |
addShort(short value)
Append a short to this column.
|
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 |
finishTransaction()
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 |
inTransaction() |
void |
release()
Release any resources held.
|
void |
setValueToRangeMap(Map<DATA_TYPE,long[]> valueToRangeMap) |
void |
startTransaction()
Begin a new transaction.
|
String |
toString() |
add, add, addBoolean, addBooleans, checkArrayAddBounds, encodeDateTime, encodeExternalizable, encodeSerializable, getAddHelper, getName, getType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
prepareCheckpoint
add, add, addBoolean, addBooleans, addFromArray, addFromBoxedValue, addFromBoxedValue, addFromColumnSource, addFromColumnSource, addFromColumnSource, addFromColumnSource, addFromDataColumn, getAddHelper, getName, getType
public void setValueToRangeMap(@NotNull Map<DATA_TYPE,long[]> valueToRangeMap)
valueToRangeMap
- Map from unique, boxed column values to long[2] position ranges.public void force()
BufferedAppendable
BufferedAppendable.prepareCheckpoint()
.
Does not imply BufferedAppendable.flush()
, as this is a distinct operation in all implementations.
May be called concurrently by threads other than the "writing thread".force
in interface AppendableColumn<DATA_TYPE>
force
in interface BufferedAppendable
public void close()
BufferedAppendable
BufferedAppendable.force()
operations. A BufferedAppendable.release()
is appropriate afterwards, especially on error.close
in interface AppendableColumn<DATA_TYPE>
close
in interface BufferedAppendable
public void flush()
BufferedAppendable
BufferedAppendable.force()
.flush
in interface BufferedAppendable
public void release()
BufferedAppendable
BufferedAppendable.force()
operations.release
in interface BufferedAppendable
public boolean inTransaction()
inTransaction
in interface TableTransactionProcessor
public void startTransaction()
TableTransactionProcessor
startTransaction
in interface TableTransactionProcessor
public void abortTransaction()
TableTransactionProcessor
Abort the current pending transaction.
This should not be called if there is no current transaction.
abortTransaction
in interface TableTransactionProcessor
public void finishTransaction()
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.
finishTransaction
in interface TableTransactionProcessor
public void addByte(byte value)
AppendableColumn
addByte
in interface AppendableColumn<DATA_TYPE>
value
- The value to appendpublic void addChar(char value)
AppendableColumn
addChar
in interface AppendableColumn<DATA_TYPE>
value
- The value to appendpublic void addDouble(double value)
AppendableColumn
addDouble
in interface AppendableColumn<DATA_TYPE>
value
- The value to appendpublic void addFloat(float value)
AppendableColumn
addFloat
in interface AppendableColumn<DATA_TYPE>
value
- The value to appendpublic void addInt(int value)
AppendableColumn
addInt
in interface AppendableColumn<DATA_TYPE>
value
- The value to appendpublic void addLong(long value)
AppendableColumn
addLong
in interface AppendableColumn<DATA_TYPE>
value
- The value to appendpublic void addShort(short value)
AppendableColumn
addShort
in interface AppendableColumn<DATA_TYPE>
value
- The value to appendpublic void addBytes(@NotNull byte[] values, int startIndex, int length)
AppendableColumn
addBytes
in interface AppendableColumn<DATA_TYPE>
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to addpublic void addBytes(@NotNull ByteBuffer inputBuffer)
AppendableColumn
addBytes
in interface AppendableColumn<DATA_TYPE>
inputBuffer
- The bufferpublic void addChars(@NotNull char[] values, int startIndex, int length)
AppendableColumn
addChars
in interface AppendableColumn<DATA_TYPE>
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to addpublic void addDoubles(@NotNull double[] values, int startIndex, int length)
AppendableColumn
addDoubles
in interface AppendableColumn<DATA_TYPE>
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to addpublic void addFloats(@NotNull float[] values, int startIndex, int length)
AppendableColumn
addFloats
in interface AppendableColumn<DATA_TYPE>
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to addpublic void addInts(@NotNull int[] values, int startIndex, int length)
AppendableColumn
addInts
in interface AppendableColumn<DATA_TYPE>
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to addpublic void addLongs(@NotNull long[] values, int startIndex, int length)
AppendableColumn
addLongs
in interface AppendableColumn<DATA_TYPE>
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to addpublic void addShorts(@NotNull short[] values, int startIndex, int length)
AppendableColumn
addShorts
in interface AppendableColumn<DATA_TYPE>
values
- The array of valuesstartIndex
- The index of the first value to addlength
- The total number of values to add