Files
steampipe/pkg/db/db_common/client.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

31 lines
1.1 KiB
Go

package db_common
import (
"context"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/turbot/steampipe/pkg/query/queryresult"
)
type Client interface {
Close(ctx context.Context) error
LoadUserSearchPath(ctx context.Context) error
SetRequiredSessionSearchPath(context.Context) error
GetRequiredSessionSearchPath() []string
GetCustomSearchPath() []string
// acquire a database connection - must be closed
AcquireConnection(ctx context.Context) (*pgxpool.Conn, error)
// acquire a query execution session (which search pathand cache options set) - must be closed
AcquireSession(context.Context) *AcquireSessionResult
ExecuteSync(context.Context, string, ...any) (*queryresult.SyncQueryResult, error)
Execute(context.Context, string, ...any) (*queryresult.Result, error)
ExecuteSyncInSession(context.Context, *DatabaseSession, string, ...any) (*queryresult.SyncQueryResult, error)
ExecuteInSession(context.Context, *DatabaseSession, func(), string, ...any) (*queryresult.Result, error)
RefreshSessions(context.Context) *AcquireSessionResult
GetSchemaFromDB(context.Context) (*SchemaMetadata, error)
}