@ThreadSafe public final class FileDatabaseHistory extends AbstractDatabaseHistory
DatabaseHistory
implementation that stores the schema history in a local file.Modifier and Type | Field and Description |
---|---|
static Collection<Field> |
ALL_FIELDS |
static Field |
FILE_PATH |
private FunctionalReadWriteLock |
lock |
private Path |
path |
private DocumentReader |
reader |
private AtomicBoolean |
running |
private static Charset |
UTF8 |
private DocumentWriter |
writer |
config, logger
CONFIGURATION_FIELD_PREFIX_STRING, NAME, SKIP_UNPARSEABLE_DDL_STATEMENTS
Constructor and Description |
---|
FileDatabaseHistory() |
Modifier and Type | Method and Description |
---|---|
void |
configure(Configuration config,
HistoryRecordComparator comparator)
Configure this instance.
|
protected void |
recoverRecords(Tables schema,
DdlParser ddlParser,
Consumer<HistoryRecord> records) |
void |
start()
Start the history.
|
void |
stop()
Stop recording history and release any resources acquired since
DatabaseHistory.configure(Configuration, HistoryRecordComparator) . |
protected void |
storeRecord(HistoryRecord record) |
String |
toString() |
record, recover
public static final Field FILE_PATH
public static Collection<Field> ALL_FIELDS
private static final Charset UTF8
private final FunctionalReadWriteLock lock
private final DocumentWriter writer
private final DocumentReader reader
private final AtomicBoolean running
private Path path
public void configure(Configuration config, HistoryRecordComparator comparator)
DatabaseHistory
configure
in interface DatabaseHistory
configure
in class AbstractDatabaseHistory
config
- the configuration for this history storecomparator
- the function that should be used to compare history records during
recovery
; may be null if the
default comparator
is to be usedpublic void start()
DatabaseHistory
start
in interface DatabaseHistory
start
in class AbstractDatabaseHistory
protected void storeRecord(HistoryRecord record) throws DatabaseHistoryException
storeRecord
in class AbstractDatabaseHistory
DatabaseHistoryException
public void stop()
DatabaseHistory
DatabaseHistory.configure(Configuration, HistoryRecordComparator)
.stop
in interface DatabaseHistory
stop
in class AbstractDatabaseHistory
protected void recoverRecords(Tables schema, DdlParser ddlParser, Consumer<HistoryRecord> records)
recoverRecords
in class AbstractDatabaseHistory
Copyright © 2017 JBoss by Red Hat. All rights reserved.