Class LocalTableWriter
java.lang.Object
com.illumon.iris.db.tables.appendable.local.LocalTableWriter
- All Implemented Interfaces:
Entry,Record,Row,TableWriter<Row>,BufferedAppendable
- Direct Known Subclasses:
LocalTableWriterImpl
public abstract class LocalTableWriter
extends Object
implements TableWriter<Row>, BufferedAppendable
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
FieldsModifier and TypeFieldDescriptionprotected booleanState marker for transactions that were created in order to discard a partial transaction, e.g.protected static final longNull size value forpendingSize, used to signify no current pending rows.protected longThe pending size of the underlying table, to become size when the current transaction finishes.Fields inherited from interface com.illumon.iris.binarystore.TableWriter
NULL_SETTER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidAbort a transaction.abstract voidadviseRowsWritten(long count) Update accounting for rows were written.abstract booleandirty()Test if there is data to flush.abstract voidEnd a transaction.abstract <CT extends LocalAppendableColumn<?>>
CTGet aLocalAppendableColumnfor use by writing code that doesn't useRowSetters.Get a writer for a Row entries.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.voidIf we're not currently in a transaction, begin one.protected voidprocessFlagsPostWrite(Row.Flags flags) Process a row's flags after writing or batching data for write.protected voidprocessFlagsPreWrite(Row.Flags flags) Process a row's flags before writing or batching data for write.abstract voidsetImportDetails(Properties importDetails) Set a trivial import state object wrapping the supplied import details to be part of checkpoints for the output table.abstract 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.abstract voidBegin a transaction.booleanTrue if all data types can be written out; false otherwise.abstract voidupdateImportState(UnaryOperator<ImportState> updater) Set the import state object (as insetImportState(ImportState)) after applying the supplied updater function to the existing import state object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.db.tables.appendable.BufferedAppendable
close, flush, force, maybeForce, prepareCheckpoint, releaseMethods inherited from interface com.illumon.iris.binarystore.Row
getColumnPartitionValue, setColumnPartitionValueMethods inherited from interface com.illumon.iris.binarystore.TableWriter
close, flush, flushDeferredRows, getColumnNames, getColumnTypes, getRecordSetter, getRecordSetter, getRecordWriter, getSetter, getSetter, setFlags, writeDeferredRow, writeRecord, writeRow
-
Field Details
-
NULL_PENDING_SIZE
protected static final long NULL_PENDING_SIZENull size value forpendingSize, used to signify no current pending rows.- See Also:
-
pendingSize
protected long pendingSizeThe pending size of the underlying table, to become size when the current transaction finishes. -
invalidTransaction
protected boolean invalidTransactionState marker for transactions that were created in order to discard a partial transaction, e.g. a series ofRow.Flags.NoneandRow.Flags.EndTransactionrecords when noRow.Flags.StartTransactionwas observed.
-
-
Constructor Details
-
LocalTableWriter
public LocalTableWriter()
-
-
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<Row>- Returns:
- true if all data types can be written out; false otherwise.
-
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<Row>- Returns:
- a Row, likely newly created
-
getColumn
public abstract <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
-
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 abstract 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 abstract 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 abstract 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. -
processFlagsPreWrite
Process a row's flags before writing or batching data for write.- Parameters:
flags- The flags for this row
-
adviseRowsWritten
public abstract void adviseRowsWritten(long count) Update accounting for rows were written.- Parameters:
count- The number of rows that were written
-
processFlagsPostWrite
Process a row's flags after writing or batching data for write.- Parameters:
flags- The flags for this row
-
dirty
public abstract boolean dirty()Test if there is data to flush.- Returns:
- Whether there is data to flush
-
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
-