hub

package
v1.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryStatusReady    queryStatus = "ready"
	QueryStatusStarted  queryStatus = "started"
	QueryStatusError    queryStatus = "error"
	QueryStatusComplete queryStatus = "complete"
)

Variables

This section is empty.

Functions

func CreateHub added in v1.11.0

func CreateHub() error

CreateHub creates the hub

Types

type Hub

type Hub interface {
	GetConnectionConfigByName(string) *proto.ConnectionConfig
	LoadConnectionConfig() (bool, error)
	GetSchema(remoteSchema string, localSchema string) (*proto.Schema, error)
	GetIterator(columns []string, quals *proto.Quals, unhandledRestrictions int, limit int64, sortOrder []*proto.SortColumn, queryTimestamp int64, opts types.Options) (Iterator, error)
	GetRelSize(columns []string, quals []*proto.Qual, opts types.Options) (types.RelSize, error)
	GetPathKeys(opts types.Options) ([]types.PathKey, error)
	Explain(columns []string, quals []*proto.Qual, sortKeys []string, verbose bool, opts types.Options) ([]string, error)
	ApplySetting(key string, value string) error
	GetSettingsSchema() map[string]*proto.TableSchema
	GetLegacySettingsSchema() map[string]*proto.TableSchema
	StartScan(i Iterator) error
	RemoveIterator(iterator Iterator)
	EndScan(iter Iterator, limit int64)
	AddScanMetadata(iter Iterator)
	Abort()
	Close()
	ProcessImportForeignSchemaOptions(opts types.Options, connectionName string) error
	HandleLegacyCacheCommand(command string) error
	ValidateCacheCommand(command string) error

	GetSortableFields(table, connection string) map[string]proto.SortOrder
	// contains filtered or unexported methods
}

TODO check which can be non-imported

func GetHub

func GetHub() Hub

GetHub returns a hub singleton

type HubLocal added in v1.11.0

type HubLocal struct {
	// contains filtered or unexported fields
}

func (*HubLocal) Abort added in v1.11.0

func (h *HubLocal) Abort()

Abort shuts down currently running queries

func (*HubLocal) AddScanMetadata added in v1.11.0

func (h *HubLocal) AddScanMetadata(i Iterator)

AddScanMetadata adds the scan metadata from the given iterator to the hubs array we append to this every time a scan completes (either due to end of data, or Postgres terminating) the full array is returned whenever a pop_scan_metadata command is received and the array is cleared

func (*HubLocal) ApplySetting added in v1.11.0

func (h *HubLocal) ApplySetting(key string, value string) error

func (*HubLocal) Close added in v1.11.0

func (h *HubLocal) Close()

Close shuts down all plugin clients

func (*HubLocal) EndScan added in v1.11.0

func (h *HubLocal) EndScan(iter Iterator, limit int64)

EndScan is called when Postgres terminates the scan (because it has received enough rows of data)

func (*HubLocal) Explain added in v1.11.0

func (h *HubLocal) Explain(columns []string, quals []*proto.Qual, sortKeys []string, verbose bool, opts types.Options) ([]string, error)

Explain :: hook called on explain.

Returns:
    An iterable of strings to display in the EXPLAIN output.

func (*HubLocal) GetConnectionConfigByName added in v1.11.0

func (l *HubLocal) GetConnectionConfigByName(name string) *proto.ConnectionConfig

func (*HubLocal) GetIterator added in v1.11.0

func (l *HubLocal) GetIterator(columns []string, quals *proto.Quals, unhandledRestrictions int, limit int64, sortOrder []*proto.SortColumn, queryTimestamp int64, opts types.Options) (Iterator, error)

func (*HubLocal) GetLegacySettingsSchema added in v1.11.0

func (h *HubLocal) GetLegacySettingsSchema() map[string]*proto.TableSchema

func (*HubLocal) GetPathKeys added in v1.11.0

func (l *HubLocal) GetPathKeys(opts types.Options) ([]types.PathKey, error)

func (*HubLocal) GetRelSize added in v1.11.0

func (h *HubLocal) GetRelSize(columns []string, quals []*proto.Qual, opts types.Options) (types.RelSize, error)

GetRelSize is a method called from the planner to estimate the resulting relation size for a scan.

It will help the planner in deciding between different types of plans,
according to their costs.
Args:
    columns (list): The list of columns that must be returned.
    quals (list): A list of Qual instances describing the filters
        applied to this scan.
Returns:
    A struct of the form (expected_number_of_rows, avg_row_width (in bytes))

func (*HubLocal) GetSchema added in v1.11.0

func (l *HubLocal) GetSchema(_, connectionName string) (*proto.Schema, error)

func (*HubLocal) GetSettingsSchema added in v1.11.0

func (h *HubLocal) GetSettingsSchema() map[string]*proto.TableSchema

func (*HubLocal) GetSortableFields added in v1.11.0

func (h *HubLocal) GetSortableFields(tableName, connectionName string) map[string]proto.SortOrder

GetSortableFields

func (*HubLocal) HandleLegacyCacheCommand added in v1.11.0

func (h *HubLocal) HandleLegacyCacheCommand(command string) error

func (*HubLocal) LoadConnectionConfig added in v1.11.0

func (l *HubLocal) LoadConnectionConfig() (bool, error)

func (*HubLocal) ProcessImportForeignSchemaOptions added in v1.11.0

func (l *HubLocal) ProcessImportForeignSchemaOptions(opts types.Options, connection string) error

func (*HubLocal) RemoveIterator added in v1.11.0

func (h *HubLocal) RemoveIterator(iterator Iterator)

RemoveIterator removes an iterator from list of running iterators

func (*HubLocal) SetConnectionConfig added in v1.11.0

func (l *HubLocal) SetConnectionConfig(connectionName, configString string) error

func (*HubLocal) StartScan added in v1.11.0

func (h *HubLocal) StartScan(i Iterator) error

StartScan starts a scan

func (*HubLocal) UpdateConnectionConfig added in v1.11.0

func (l *HubLocal) UpdateConnectionConfig(connectionName, configString string) error

func (*HubLocal) ValidateCacheCommand added in v1.11.0

func (h *HubLocal) ValidateCacheCommand(command string) error

type Iterator

type Iterator interface {
	// GetConnectionName returns the connection name that this iterator uses.
	GetConnectionName() string
	GetPluginName() string
	// Next returns a row. Nil slice means there is no more rows to scan.
	Next() (map[string]interface{}, error)
	// Close stops an iteration and frees any resources.
	Close()
	Status() queryStatus
	Error() error
	CanIterate() bool
	GetQueryTimestamp() int64
	GetTraceContext() *telemetry.TraceCtx
}

Iterator is an interface for table scanner implementations.

type QueryResult added in v1.3.0

type QueryResult struct {
	Rows []map[string]interface{}
}

func (*QueryResult) Append added in v1.3.0

func (q *QueryResult) Append(row map[string]interface{})

type RemoteHub added in v1.11.0

type RemoteHub struct {
	// contains filtered or unexported fields
}

RemoteHub is a structure representing plugin hub

func (*RemoteHub) Abort added in v1.11.0

func (h *RemoteHub) Abort()

Abort shuts down currently running queries

func (*RemoteHub) AddScanMetadata added in v1.11.0

func (h *RemoteHub) AddScanMetadata(i Iterator)

AddScanMetadata adds the scan metadata from the given iterator to the hubs array we append to this every time a scan completes (either due to end of data, or Postgres terminating) the full array is returned whenever a pop_scan_metadata command is received and the array is cleared

func (*RemoteHub) ApplySetting added in v1.11.0

func (h *RemoteHub) ApplySetting(key string, value string) error

func (*RemoteHub) Close added in v1.11.0

func (h *RemoteHub) Close()

Close shuts down all plugin clients

func (*RemoteHub) EndScan added in v1.11.0

func (h *RemoteHub) EndScan(iter Iterator, limit int64)

EndScan is called when Postgres terminates the scan (because it has received enough rows of data)

func (*RemoteHub) Explain added in v1.11.0

func (h *RemoteHub) Explain(columns []string, quals []*proto.Qual, sortKeys []string, verbose bool, opts types.Options) ([]string, error)

Explain :: hook called on explain.

Returns:
    An iterable of strings to display in the EXPLAIN output.

func (*RemoteHub) GetConnectionConfigByName added in v1.11.0

func (h *RemoteHub) GetConnectionConfigByName(string) *proto.ConnectionConfig

func (*RemoteHub) GetIterator added in v1.11.0

func (h *RemoteHub) GetIterator(columns []string, quals *proto.Quals, unhandledRestrictions int, limit int64, sortOrder []*proto.SortColumn, queryTimestamp int64, opts types.Options) (Iterator, error)

GetIterator creates and returns an iterator

func (*RemoteHub) GetLegacySettingsSchema added in v1.11.0

func (h *RemoteHub) GetLegacySettingsSchema() map[string]*proto.TableSchema

func (*RemoteHub) GetPathKeys added in v1.11.0

func (h *RemoteHub) GetPathKeys(opts types.Options) ([]types.PathKey, error)

GetPathKeys Is a method called from the planner to add additional Path to the planner.

fetch schema and call base implementation

func (*RemoteHub) GetRelSize added in v1.11.0

func (h *RemoteHub) GetRelSize(columns []string, quals []*proto.Qual, opts types.Options) (types.RelSize, error)

GetRelSize is a method called from the planner to estimate the resulting relation size for a scan.

It will help the planner in deciding between different types of plans,
according to their costs.
Args:
    columns (list): The list of columns that must be returned.
    quals (list): A list of Qual instances describing the filters
        applied to this scan.
Returns:
    A struct of the form (expected_number_of_rows, avg_row_width (in bytes))

func (*RemoteHub) GetSchema added in v1.11.0

func (h *RemoteHub) GetSchema(remoteSchema string, localSchema string) (*proto.Schema, error)

GetSchema returns the schema for a name. Load the plugin for the connection if needed

func (*RemoteHub) GetSettingsSchema added in v1.11.0

func (h *RemoteHub) GetSettingsSchema() map[string]*proto.TableSchema

func (*RemoteHub) GetSortableFields added in v1.11.0

func (h *RemoteHub) GetSortableFields(tableName, connectionName string) map[string]proto.SortOrder

GetSortableFields returns a slice of fields which are defined as sortable bythe plugin schema, as well as the sort order(s) supported

func (*RemoteHub) HandleLegacyCacheCommand added in v1.11.0

func (h *RemoteHub) HandleLegacyCacheCommand(command string) error

func (*RemoteHub) LoadConnectionConfig added in v1.11.0

func (h *RemoteHub) LoadConnectionConfig() (bool, error)

LoadConnectionConfig loads the connection config and returns whether it has changed

func (*RemoteHub) ProcessImportForeignSchemaOptions added in v1.11.0

func (h *RemoteHub) ProcessImportForeignSchemaOptions(types.Options, string) error

func (*RemoteHub) RemoveIterator added in v1.11.0

func (h *RemoteHub) RemoveIterator(iterator Iterator)

RemoveIterator removes an iterator from list of running iterators

func (*RemoteHub) StartScan added in v1.11.0

func (h *RemoteHub) StartScan(i Iterator) error

StartScan starts a scan

func (*RemoteHub) ValidateCacheCommand added in v1.11.0

func (h *RemoteHub) ValidateCacheCommand(command string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL