CatalogWatcher

class CatalogWatcher(catalog: WarehouseCatalog, commands: () -> CommandClient, interval: Duration, sources: CatalogSources) : SmartLifecycle

The change detection of the catalog: every interval, it lists each database's tables and views (their uuid, metadata modification time and a fingerprint of their columns, system.tables and system.columns: the time is in seconds, so an ALTER in the second of the last look shows only in the columns) and when each last got a wow_catalog row, and sends SyncSource for each table whose listing changed since it last looked, or that is gone: the source's aggregate reads the table again and applies the trust rules. Its first look of a database, at startup, syncs every table, which changes nothing where nothing changed, and every table the catalog holds a source of there (sources) that the warehouse no longer lists: one dropped while the catalog was down is marked missing too.

It sends through the node's CommandClient as CALLER, a catalog administrator (SyncSource reads only what the warehouse says, so whoever sends it changes nothing the warehouse does not). A failed look is logged and tried again at the next one.

Constructors

Link copied to clipboard
constructor(catalog: WarehouseCatalog, commands: () -> CommandClient, interval: Duration, sources: CatalogSources)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val isRunning: Boolean
Link copied to clipboard
open override val phase: Int

Functions

Link copied to clipboard
open override fun getPhase(): Int

After the node and its public server started: the node takes commands by then.

Link copied to clipboard
open override fun isRunning(): Boolean
Link copied to clipboard
suspend fun look(): Int

Looks at the warehouse once: the tables whose listing changed since the last look are synced.

Link copied to clipboard
open override fun start()
Link copied to clipboard
open override fun stop()