Class LocalTableWriter
java.lang.Object
com.illumon.iris.db.tables.appendable.local.LocalTableWriter
- All Implemented Interfaces:
Entry,Record,Row,TableWriter,BufferedAppendable
- Direct Known Subclasses:
DiskTableWriter
TableWriter for concurrently-readable table writing to a local table location.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.binarystore.Record
Record.RecordSetter<T extends RecordData> -
Field Summary
Fields inherited from interface com.illumon.iris.binarystore.TableWriter
NULL_SETTER -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a writer for the supplied table.LocalTableWriter(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.Get a writer for a Row entries.Gets a setter for a column.final booleanCheck whether an invalid transaction (which will never succeed) is in progress.final booleanCheck whether a transaction is in progress.final voidAbort a transaction if one is in progress.final voidEnd a transaction if one is in progress.booleanPerform aBufferedAppendable.force()if there is data pending persistence.voidIf we're not currently in a transaction, begin one.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 that is guaranteed to never succeed.final voidBegin a transaction.booleanTrue if all data types can be written out; false otherwise.voidupdateImportState(UnaryOperator<ImportState> updater) Set the import state object (as insetImportState(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 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
-
LocalTableWriter
Construct a writer for the supplied table.- Parameters:
table- The table to write to
-
LocalTableWriter
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
-
supportAllTypes
public boolean supportAllTypes()Description copied from interface:TableWriterTrue if all data types can be written out; false otherwise.- Specified by:
supportAllTypesin interfaceTableWriter- Returns:
- true if all data types can be written out; false otherwise.
-
getColumnNames
Description copied from interface:TableWriterGets the column names for the table.- Specified by:
getColumnNamesin interfaceTableWriter- Returns:
- column names for the table.
-
getColumnTypes
Description copied from interface:TableWriterGets the column types for the table.- Specified by:
getColumnTypesin interfaceTableWriter- Returns:
- column types for the table.
-
getRowWriter
Description copied from interface:TableWriterGet a writer for a Row entries. This is likely to be newly created, so callers should cache this value. In practice, TableWriter implementations generally cache the result of the first call to this method as a primary writer.- Specified by:
getRowWriterin interfaceTableWriter- Returns:
- a Row, likely newly created
-
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.- Specified by:
getSetterin interfaceRow- Specified by:
getSetterin interfaceTableWriter- Parameters:
columnName- column name- Returns:
- setter for the column.
-
getColumn
public <CT extends LocalAppendableColumn<?>> CT getColumn(@NotNull String name, @NotNull Class<CT> clazz) Get aLocalAppendableColumnfor use by writing code that doesn't useRowSetters.- 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.- Specified by:
setFlagsin interfaceRow- Specified by:
setFlagsin interfaceTableWriter
-
inTransaction
public final boolean inTransaction()Check whether a transaction is in progress.- Returns:
- Whether a transaction is in progress
-
inInvalidTransaction
public final boolean inInvalidTransaction()Check whether an invalid transaction (which will never succeed) is in progress.- Returns:
- Whether an invalid transaction is in progress
-
startTransaction
public final void startTransaction()Begin a transaction. It is an error to call this method if a transaction is already in progress. -
maybeStartTransaction
public void maybeStartTransaction()If we're not currently in a transaction, begin one. -
startInvalidTransaction
public final void startInvalidTransaction()Begin a transaction that is guaranteed to never succeed. It is an error to call this method if a transaction is already in progress. -
abortTransaction
public final void abortTransaction()Abort a transaction. It is an error to call this method if a transaction is not in progress. -
maybeAbortTransaction
public final void maybeAbortTransaction()Abort a transaction if one is in progress. -
endTransaction
public final void endTransaction()End a transaction. It is an error to call this method if a transaction is not in progress or the current transaction is invalid. -
maybeEndTransaction
public final void maybeEndTransaction()End a transaction if one is in progress. -
adviseRowsWritten
public final void adviseRowsWritten(long count) Update accounting for rows were written.- 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.- Specified by:
writeRowin interfaceRow- Specified by:
writeRowin interfaceTableWriter- Throws:
IOException- problem writing the row
-
dirty
public boolean dirty()Test if there is data to flush.- Returns:
- Whether there is data to flush
-
flush
public void flush()Description copied from interface:TableWriterFlushes data out.- Specified by:
flushin interfaceBufferedAppendable- Specified by:
flushin interfaceTableWriter
-
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.- Specified by:
prepareCheckpointin interfaceBufferedAppendable
-
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 interfaceBufferedAppendable
-
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.- Specified by:
maybeForcein interfaceBufferedAppendable- 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.- Specified by:
closein interfaceBufferedAppendable- Specified by:
closein interfaceTableWriter
-
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
-
updateImportState
Set the import state object (as insetImportState(ImportState)) after applying the supplied updater function to the existing import state object.- Parameters:
updater- The import state updater
-
setImportState
Set an import state object to be part of checkpoints for the output table.- Parameters:
importState- The import state
-
setImportDetails
Set a trivial import state object wrapping the supplied import details to be part of checkpoints for the output table.- Parameters:
importDetails- The import details
-