public abstract class AbstractDatabaseHistory extends Object implements DatabaseHistory
| Modifier and Type | Field and Description |
|---|---|
private HistoryRecordComparator |
comparator |
protected Configuration |
config |
protected org.slf4j.Logger |
logger |
CONFIGURATION_FIELD_PREFIX_STRING| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDatabaseHistory() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(Configuration config,
HistoryRecordComparator comparator)
Configure this instance.
|
void |
record(Map<String,?> source,
Map<String,?> position,
String databaseName,
Tables schema,
String ddl)
Record a change to the schema of the named database, and store it in the schema storage.
|
void |
recover(Map<String,?> source,
Map<String,?> position,
Tables schema,
DdlParser ddlParser)
Recover the
database schema to a known point in its history. |
protected abstract 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 abstract void |
storeRecord(HistoryRecord record) |
protected final org.slf4j.Logger logger
protected Configuration config
private HistoryRecordComparator comparator
public void configure(Configuration config, HistoryRecordComparator comparator)
DatabaseHistoryconfigure in interface DatabaseHistoryconfig - 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()
DatabaseHistorystart in interface DatabaseHistorypublic final void record(Map<String,?> source, Map<String,?> position, String databaseName, Tables schema, String ddl)
DatabaseHistoryrecord in interface DatabaseHistorysource - the information about the source database; may not be nullposition - the point in history where these DDL changes were made, which may be used when
recovering the schema to some point in history; may not be
nulldatabaseName - the name of the database whose schema is being changed; may be nullschema - the current definition of the database schema; may not be nullddl - the DDL statements that describe the changes to the database schema; may not be nullpublic final void recover(Map<String,?> source, Map<String,?> position, Tables schema, DdlParser ddlParser)
DatabaseHistorydatabase schema to a known point in its history. Note that it is possible to recover the
database schema to a point in history that is earlier than what has been recorded. Likewise, when recovering to a point in history later than what was recorded, the database schema will
reflect the latest state known to the history.recover in interface DatabaseHistorysource - the information about the source database; may not be nullposition - the point in history at which the database schema should be recovered; may not be nullschema - the table definitions that should be changed to reflect the database schema at the desired point in history;
may not be nullddlParser - the DDL parser that can be used to apply DDL statements to the given schema; may not be nullprotected abstract void storeRecord(HistoryRecord record)
protected abstract void recoverRecords(Tables schema, DdlParser ddlParser, Consumer<HistoryRecord> records)
public void stop()
DatabaseHistoryDatabaseHistory.configure(Configuration, HistoryRecordComparator).stop in interface DatabaseHistoryCopyright © 2016 JBoss by Red Hat. All rights reserved.