Class CachingCatalog

    • Field Detail

      • expirationIntervalMillis

        protected final long expirationIntervalMillis
      • tableCache

        protected final com.github.benmanes.caffeine.cache.Cache<TableIdentifier,​Table> tableCache
    • Constructor Detail

      • CachingCatalog

        protected CachingCatalog​(Catalog catalog,
                                 boolean caseSensitive,
                                 long expirationIntervalMillis,
                                 com.github.benmanes.caffeine.cache.Ticker ticker)
    • Method Detail

      • wrap

        public static Catalog wrap​(Catalog catalog,
                                   long expirationIntervalMillis)
      • wrap

        public static Catalog wrap​(Catalog catalog,
                                   boolean caseSensitive,
                                   long expirationIntervalMillis)
      • name

        public java.lang.String name()
        Description copied from interface: Catalog
        Return the name for this catalog.
        Specified by:
        name in interface Catalog
        Returns:
        this catalog's name
      • listTables

        public java.util.List<TableIdentifier> listTables​(Namespace namespace)
        Description copied from interface: Catalog
        Return all the identifiers under this namespace.
        Specified by:
        listTables in interface Catalog
        Parameters:
        namespace - a namespace
        Returns:
        a list of identifiers for tables
      • loadTable

        public Table loadTable​(TableIdentifier ident)
        Description copied from interface: Catalog
        Load a table.
        Specified by:
        loadTable in interface Catalog
        Parameters:
        ident - a table identifier
        Returns:
        instance of Table implementation referred by tableIdentifier
      • dropTable

        public boolean dropTable​(TableIdentifier ident,
                                 boolean purge)
        Description copied from interface: Catalog
        Drop a table; optionally delete data and metadata files.

        If purge is set to true the implementation should delete all data and metadata files.

        Specified by:
        dropTable in interface Catalog
        Parameters:
        ident - a table identifier
        purge - if true, delete all data and metadata files in the table
        Returns:
        true if the table was dropped, false if the table did not exist
      • invalidateTable

        public void invalidateTable​(TableIdentifier ident)
        Description copied from interface: Catalog
        Invalidate cached table metadata from current catalog.

        If the table is already loaded or cached, drop cached data. If the table does not exist or is not cached, do nothing.

        Specified by:
        invalidateTable in interface Catalog
        Parameters:
        ident - a table identifier
      • buildTable

        public Catalog.TableBuilder buildTable​(TableIdentifier identifier,
                                               Schema schema)
        Description copied from interface: Catalog
        /** Instantiate a builder to either create a table or start a create/replace transaction.
        Specified by:
        buildTable in interface Catalog
        Parameters:
        identifier - a table identifier
        schema - a schema
        Returns:
        the builder to create a table or start a create/replace transaction