Class LocalTableWriterImpl
java.lang.Object
com.illumon.iris.db.tables.appendable.local.LocalTableWriter
com.illumon.iris.db.tables.appendable.local.LocalTableWriterImpl
- All Implemented Interfaces:
Entry,Record,Row,TableWriter<Row>,BufferedAppendable
- Direct Known Subclasses:
DiskTableWriter
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.binarystore.Record
Record.RecordSetter<T extends RecordData> -
Field Summary
Fields inherited from class com.illumon.iris.db.tables.appendable.local.LocalTableWriter
invalidTransaction, NULL_PENDING_SIZE, pendingSizeFields inherited from interface com.illumon.iris.binarystore.TableWriter
NULL_SETTER -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a writer for the supplied table.LocalTableWriterImpl(LocalAppendableTable table, boolean needRowSupport) Construct a writer for the supplied table. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidAbort a transaction.final voidadviseRowsWritten(long count) Update accounting for rows were written.voidclose()Closes the writer.booleandirty()Test if there is data to flush.final voidEnd a transaction.voidflush()Flushes data out.voidforce()Force all flushed data to be persisted to permanent storage.<CT extends LocalAppendableColumn<?>>
CTGet aLocalAppendableColumnfor use by writing code that doesn't useRowSetters.String[]Gets the column names for the table.Class[]Gets the column types for the table.Gets a setter for a column.booleanPerform aBufferedAppendable.force()if there is data pending persistence.voidOptional operation.voidrelease()Release any resources held.voidvoidsetImportDetails(Properties importDetails) Set a trivial import state object wrapping the supplied import details to be part of checkpoints for the output table.voidsetImportState(ImportState importState) Set an import state object to be part of checkpoints for the output table.final voidBegin a transaction.voidupdateImportState(UnaryOperator<ImportState> updater) Set the import state object (as inLocalTableWriter.setImportState(ImportState)) after applying the supplied updater function to the existing import state object.final voidwriteRow()Writes out a new row (values set using setters).Methods inherited from class com.illumon.iris.db.tables.appendable.local.LocalTableWriter
getRowWriter, inInvalidTransaction, inTransaction, maybeAbortTransaction, maybeEndTransaction, maybeStartTransaction, processFlagsPostWrite, processFlagsPreWrite, startInvalidTransaction, supportAllTypesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.binarystore.Row
getColumnPartitionValue, setColumnPartitionValueMethods inherited from interface com.illumon.iris.binarystore.TableWriter
flushDeferredRows, getRecordSetter, getRecordSetter, getRecordWriter, getSetter, writeDeferredRow, writeRecord
-
Constructor Details
-
LocalTableWriterImpl
Construct a writer for the supplied table.- Parameters:
table- The table to write to
-
LocalTableWriterImpl
Construct a writer for the supplied table.- Parameters:
table- The table to write toneedRowSupport- Should this local table writer allocate aRowfor traditional row-by-row ingest
-
-
Method Details
-
getColumnNames
Description copied from interface:TableWriterGets the column names for the table.- Returns:
- column names for the table.
-
getColumnTypes
Description copied from interface:TableWriterGets the column types for the table.- Returns:
- column types for the table.
-
getSetter
Description copied from interface:TableWriterGets a setter for a column.The implementation is likely to delegate to
Row.getSetter(String)in a default Row instance.- Parameters:
columnName- column name- Returns:
- setter for the column.
-
getColumn
public <CT extends LocalAppendableColumn<?>> CT getColumn(@NotNull String name, @NotNull Class<CT> clazz) Description copied from class:LocalTableWriterGet aLocalAppendableColumnfor use by writing code that doesn't useRowSetters.- Specified by:
getColumnin classLocalTableWriter- Parameters:
name- The column nameclazz- The expected column class- Returns:
- The column
-
setFlags
Description copied from interface:TableWriterThe implementation is likely to delegate to
Row.setFlags(Flags)in a default Row instance. -
startTransaction
public final void startTransaction()Description copied from class:LocalTableWriterBegin a transaction. It is an error to call this method if a transaction is already in progress.- Specified by:
startTransactionin classLocalTableWriter
-
abortTransaction
public final void abortTransaction()Description copied from class:LocalTableWriterAbort a transaction. It is an error to call this method if a transaction is not in progress.- Specified by:
abortTransactionin classLocalTableWriter
-
endTransaction
public final void endTransaction()Description copied from class:LocalTableWriterEnd a transaction. It is an error to call this method if a transaction is not in progress or the current transaction is invalid.- Specified by:
endTransactionin classLocalTableWriter
-
adviseRowsWritten
public final void adviseRowsWritten(long count) Description copied from class:LocalTableWriterUpdate accounting for rows were written.- Specified by:
adviseRowsWrittenin classLocalTableWriter- Parameters:
count- The number of rows that were written
-
writeRow
Description copied from interface:TableWriterWrites out a new row (values set using setters).The implementation is likely to delegate to
Row.writeRow()in a default Row instance.- Throws:
IOException- problem writing the row
-
dirty
public boolean dirty()Description copied from class:LocalTableWriterTest if there is data to flush.- Specified by:
dirtyin classLocalTableWriter- Returns:
- Whether there is data to flush
-
flush
public void flush()Description copied from interface:TableWriterFlushes data out. -
prepareCheckpoint
public void prepareCheckpoint()Description copied from interface:BufferedAppendableOptional operation. Prepare a checkpoint snapshot for the next call toBufferedAppendable.force(). Should be called directly afterBufferedAppendable.flush(), with no intervening modification operations. -
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". -
maybeForce
public boolean maybeForce()Description copied from interface:BufferedAppendablePerform aBufferedAppendable.force()if there is data pending persistence. Implementations that don't keep track of pending data explicitly will always invokeBufferedAppendable.force()pessimistically.- Returns:
- Whether this call may have done any actual work (i.e. there was data pending or assumed to be pending)
-
close
public void close()Description copied from interface:TableWriterCloses the writer. -
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. -
updateImportState
Description copied from class:LocalTableWriterSet the import state object (as inLocalTableWriter.setImportState(ImportState)) after applying the supplied updater function to the existing import state object.- Specified by:
updateImportStatein classLocalTableWriter- Parameters:
updater- The import state updater
-
setImportState
Description copied from class:LocalTableWriterSet an import state object to be part of checkpoints for the output table.- Specified by:
setImportStatein classLocalTableWriter- Parameters:
importState- The import state
-
setImportDetails
Description copied from class:LocalTableWriterSet a trivial import state object wrapping the supplied import details to be part of checkpoints for the output table.- Specified by:
setImportDetailsin classLocalTableWriter- Parameters:
importDetails- The import details
-