The internal schema contains the following introspection tables
steampipe_connection
Lists all connections as defined in the connection config.- `` Lists all plugin instances as defined in the connection config.
steampipe_plugin_limiter
Lists all plugin Limiters as defined either in the plugin binary or the plugin connection block
- Every time the server is started, the connections are loaded from the table into ConnectionState structs.
- The table is then deleted and recreated - this is to handle any updates to the table structure
- The connection states are set to either
pending
(if currentlyready
) orincomplete
(if not). (These states will be updated by RefreshConnections.) - The connections are written back to the table
- RefreshConnections is triggered - this will apply any necessary connection updates and set the states of the connections
to either
ready
orerror
- Every time the server is started, table is then deleted and recreated - this is to handle any updates to the table structure
- The configured plugin instances are written back to the table
(See postServiceStart
in pkg/db/db_local/internal.go)
The when a connection file is changed the ConnectionWatcher calls pluginManager.OnConnectionConfigChanged
, and then calls
RefreshConnections
asyncronously
OnConnectionConfigChanged
calls:
handleConnectionConfigChanges
handlePluginInstanceChanges
handleUserLimiterChanges
handleConnectionConfigChanges
determines which connections have been added, removed and deleted. It then builds a set of SetConnectionConfigRequest, one for each plugin instance with changed connections
handlePluginInstanceChanges
determines which plugins have been added, removed and deleted.
It updates the steampipe_plugin
table.
###TODO if the plugin for an instance changes, all connections must be dropped and re-added
handleUserLimiterChanges
determines which plugin instances have changed limiter definitions.
It updates the steampipe_rate_limiter
table and makes a SetRateLimiters
call to all plugin instances
with updated rate limiters.
RefreshConnections
updates the plugin schemas to correspond with the updated connection config
- Every time the server is started, table is then deleted and recreated - this is to handle any updates to the table structure
- The configured plugin instances are written back to the table
The when a connection file is changed the ConnectionWatcher calls pluginManager.OnConnectionConfigChanged
, and then calls
RefreshConnections
asyncronously
OnConnectionConfigChanged
determines which connections have been added, removed and deleted.
It then builds a set of SetConnectionConfigRequest, one for each plugin instance with changed connections
steampipe_plugin
is
steampipe_connection
table is used to determine whether a connection has been loaded yet.
This is used to allow us to execute queries without wasiting for all connections to load. Instead, we execute the query,
and if it fails with a relation not found error, we poll the coneciton state table until the connection is ready.
Then we retry the query.