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, waitcreateTable, createTable, createTable, createTable, dropTable, initialize, newCreateTableTransaction, newCreateTableTransaction, newCreateTableTransaction, newCreateTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, newReplaceTableTransaction, tableExistsprotected 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()
Catalogpublic java.util.List<TableIdentifier> listTables(Namespace namespace)
CataloglistTables in interface Catalognamespace - a namespacepublic Table loadTable(TableIdentifier ident)
Catalogpublic boolean dropTable(TableIdentifier ident, boolean purge)
CatalogIf purge is set to true the implementation should delete all data and metadata files.
public void renameTable(TableIdentifier from, TableIdentifier to)
CatalogrenameTable in interface Catalogfrom - identifier of the table to renameto - new table namepublic void invalidateTable(TableIdentifier ident)
CatalogIf 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 Catalogident - a table identifierpublic Table registerTable(TableIdentifier identifier, java.lang.String metadataFileLocation)
CatalogregisterTable in interface Catalogidentifier - a table identifiermetadataFileLocation - the location of a metadata filepublic Catalog.TableBuilder buildTable(TableIdentifier identifier, Schema schema)
CatalogbuildTable in interface Catalogidentifier - a table identifierschema - a schema