Files
steampipe/pkg/steampipeconfig/load_connection_state_option.go
kaidaguerre 40804a3201 Execute RefreshConnections asyncronously and optimise for high connection count. Add connection_state table.
- Execute RefreshConnections asyncronously
- Add connection_state table to indicate the loading state of connections
- Optimise RefreshConnections by cloning connection schemas
- Add locking to ensure only a single instance of RefreshConnections runs
- Start executing queries without waiting for connections to load, add smart error handling to wait for required connection
- Optimise autocomplete for high connection count
- Autocomplete and inspect data available before all conections are refreshed
- Update file watcher to respond to CHMOD, so thaat it pickes up deletion of file contents

 Closes #3394
 Closes #3267
2023-05-10 09:05:08 +01:00

41 lines
1.1 KiB
Go

package steampipeconfig
type WaitModeValue int
const (
NoWait WaitModeValue = iota
WaitForLoading
WaitForReady
WaitForSearchPath
)
type LoadConnectionStateConfiguration struct {
WaitMode WaitModeValue
Connections []string
SearchPath []string
}
type LoadConnectionStateOption = func(config *LoadConnectionStateConfiguration)
// WithWaitUntilLoading waits until no connections are in pending state
var WithWaitUntilLoading = func() func(config *LoadConnectionStateConfiguration) {
return func(config *LoadConnectionStateConfiguration) {
config.WaitMode = WaitForLoading
}
}
var WithWaitForSearchPath = func(searchPath []string) func(config *LoadConnectionStateConfiguration) {
return func(config *LoadConnectionStateConfiguration) {
config.WaitMode = WaitForSearchPath
config.SearchPath = searchPath
}
}
// WithWaitUntilReady waits until all are in ready state
var WithWaitUntilReady = func(connections ...string) func(config *LoadConnectionStateConfiguration) {
return func(config *LoadConnectionStateConfiguration) {
config.Connections = connections
config.WaitMode = WaitForReady
}
}