public class CachingCatalog extends java.lang.Object implements Catalog
See CatalogProperties.CACHE_EXPIRATION_INTERVAL_MS
for more details regarding special
values for expirationIntervalMillis
.
Catalog.TableBuilder
Modifier and Type | Field and Description |
---|---|
protected long |
expirationIntervalMillis |
protected com.github.benmanes.caffeine.cache.Cache<TableIdentifier,Table> |
tableCache |
Modifier | Constructor and Description |
---|---|
protected |
CachingCatalog(Catalog catalog,
boolean caseSensitive,
long expirationIntervalMillis,
com.github.benmanes.caffeine.cache.Ticker ticker) |
Modifier and Type | Method and Description |
---|---|
Catalog.TableBuilder |
buildTable(TableIdentifier identifier,
Schema schema)
/** Instantiate a builder to either create a table or start a create/replace transaction.
|
boolean |
dropTable(TableIdentifier ident,
boolean purge)
Drop a table; optionally delete data and metadata files.
|
void |
invalidateTable(TableIdentifier ident)
Invalidate cached table metadata from current catalog.
|
java.util.List<TableIdentifier> |
listTables(Namespace namespace)
Return all the identifiers under this namespace.
|
Table |
loadTable(TableIdentifier ident)
Load a table.
|
java.lang.String |
name()
Return the name for this catalog.
|
Table |
registerTable(TableIdentifier identifier,
java.lang.String metadataFileLocation)
Register a table with the catalog if it does not exist.
|
void |
renameTable(TableIdentifier from,
TableIdentifier to)
Rename a table.
|
static Catalog |
wrap(Catalog catalog) |
static Catalog |
wrap(Catalog catalog,
boolean caseSensitive,
long expirationIntervalMillis) |
static Catalog |
wrap(Catalog catalog,
long expirationIntervalMillis) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createTable, createTable, createTable, createTable, dropTable, initialize, newCreateTableTransaction, newCreateTableTransaction, newCreateTableTransaction, newCreateTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, tableExists
protected final long expirationIntervalMillis
protected final com.github.benmanes.caffeine.cache.Cache<TableIdentifier,Table> tableCache
protected CachingCatalog(Catalog catalog, boolean caseSensitive, long expirationIntervalMillis, com.github.benmanes.caffeine.cache.Ticker ticker)
public static Catalog wrap(Catalog catalog, boolean caseSensitive, long expirationIntervalMillis)
public java.lang.String name()
Catalog
public java.util.List<TableIdentifier> listTables(Namespace namespace)
Catalog
listTables
in interface Catalog
namespace
- a namespacepublic Table loadTable(TableIdentifier ident)
Catalog
public boolean dropTable(TableIdentifier ident, boolean purge)
Catalog
If purge is set to true the implementation should delete all data and metadata files.
public void renameTable(TableIdentifier from, TableIdentifier to)
Catalog
renameTable
in interface Catalog
from
- identifier of the table to renameto
- new table namepublic void invalidateTable(TableIdentifier ident)
Catalog
If the table is already loaded or cached, drop cached data. If the table does not exist or is not cached, do nothing.
invalidateTable
in interface Catalog
ident
- a table identifierpublic Table registerTable(TableIdentifier identifier, java.lang.String metadataFileLocation)
Catalog
registerTable
in interface Catalog
identifier
- a table identifiermetadataFileLocation
- the location of a metadata filepublic Catalog.TableBuilder buildTable(TableIdentifier identifier, Schema schema)
Catalog
buildTable
in interface Catalog
identifier
- a table identifierschema
- a schema