public class LocalAppendableTable extends Object implements BufferedAppendableTable<LocalAppendableColumn>, TableTransactionProcessor
| Modifier and Type | Field and Description |
|---|---|
static int |
OPTION_APPEND
Option for tables that should append to existing data.
|
static int |
OPTION_WRITE_THROUGH
Option for tables that should write through to concurrently-readable data stores.
|
static int |
OPTIONS_DEFAULT
Option for tables that should truncate existing data and not write through to concurrently-readable data
stores.
|
| Constructor and Description |
|---|
LocalAppendableTable(TableDefinition inputDefinition,
WritableLocalTableLocation location,
int options,
StringCacheProvider stringCacheProvider)
Construct a LocalAppendableTable for the supplied definition, location, options, and string caching.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abortTransaction()
Abort the current pending transaction.
|
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.
|
LocalAppendableColumn |
getColumn(String columnName)
Get a column for this table by name.
|
Map<String,LocalAppendableColumn> |
getColumnMap() |
LocalAppendableColumn[] |
getColumns() |
TableDefinition |
getDefinition() |
boolean |
inTransaction() |
void |
prepareCheckpoint()
Optional operation.
|
void |
release()
Release any resources held.
|
void |
setImportDetails(Properties importDetails)
Set a trivial import state object wrapping the supplied import details to be part of checkpoints for the output table location.
|
void |
setImportState(ImportState importState)
Set an import state object to be part of checkpoints for the output table location, and invoke the appropriate
ImportState.onResume(FullTableLocationKey). |
long |
size() |
void |
startTransaction()
Begin a new transaction.
|
void |
updateImportState(UnaryOperator<ImportState> updater)
Set the import state object (as in
LocalAppendableTable.setImportState(ImportState)) after applying the supplied updater
function to the existing import state object. |
void |
updateSize(long size)
Set the size of this appendable table in rows.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddRecordspublic static final int OPTIONS_DEFAULT
public static final int OPTION_APPEND
public static final int OPTION_WRITE_THROUGH
public LocalAppendableTable(@NotNull
TableDefinition inputDefinition,
@NotNull
WritableLocalTableLocation location,
int options,
@NotNull
StringCacheProvider stringCacheProvider)
Construct a LocalAppendableTable for the supplied definition, location, options, and string caching.
Note that the table name used for persisting a per-location writable table definition will be derived
from inputDefinition and location according to LocalAppendableTable.findTableName(TableDefinition, LocalTableLocation).
inputDefinition - The definitionlocation - The destinationoptions - Options bitmapstringCacheProvider - String cache provider to usepublic TableDefinition getDefinition()
getDefinition in interface AppendableTable<LocalAppendableColumn>public LocalAppendableColumn[] getColumns()
getColumns in interface AppendableTable<LocalAppendableColumn>public LocalAppendableColumn getColumn(@NotNull String columnName)
AppendableTablegetColumn in interface AppendableTable<LocalAppendableColumn>columnName - The column namepublic Map<String,LocalAppendableColumn> getColumnMap()
getColumnMap in interface AppendableTable<LocalAppendableColumn>public long size()
size in interface AppendableTable<LocalAppendableColumn>public void updateSize(long size)
AppendableTableAppendableTable.flush() method.updateSize in interface AppendableTable<LocalAppendableColumn>size - The new sizepublic void updateImportState(@NotNull
UnaryOperator<ImportState> updater)
LocalAppendableTable.setImportState(ImportState)) after applying the supplied updater
function to the existing import state object.updater - The import state updaterpublic void setImportState(@Nullable
ImportState importState)
ImportState.onResume(FullTableLocationKey).importState - The import statepublic void setImportDetails(@NotNull
Properties importDetails)
importDetails - The import detailspublic boolean inTransaction()
inTransaction in interface TableTransactionProcessorpublic void startTransaction()
TableTransactionProcessorstartTransaction in interface TableTransactionProcessorpublic void abortTransaction()
TableTransactionProcessorAbort the current pending transaction.
This should not be called if there is no current transaction.
abortTransaction in interface TableTransactionProcessorpublic void finishTransaction()
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.
finishTransaction in interface TableTransactionProcessorpublic void flush()
BufferedAppendableBufferedAppendable.force().flush in interface AppendableTable<LocalAppendableColumn>flush in interface BufferedAppendablepublic void prepareCheckpoint()
BufferedAppendable.force().
Should be called directly after BufferedAppendable.flush(), with no intervening modification operations.
Callers should use LocalAppendableTable.release() in the event that this method throws, rather than LocalAppendableTable.close().prepareCheckpoint in interface BufferedAppendablepublic void force()
BufferedAppendableBufferedAppendable.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 BufferedAppendablepublic void close()
BufferedAppendableBufferedAppendable.force() operations. A BufferedAppendable.release() is appropriate afterwards, especially on error.close in interface AppendableTable<LocalAppendableColumn>close in interface BufferedAppendablepublic void release()
BufferedAppendableBufferedAppendable.force() operations.release in interface BufferedAppendable