connection_config

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildValidationWarningString added in v0.2.0

func BuildValidationWarningString(failures []*ValidationFailure) string

func GetPluginPath

func GetPluginPath(remoteSchema string) (string, error)

func HandleGrpcError added in v0.2.0

func HandleGrpcError(err error, connection, call string) error

func PluginFQNToSchemaName

func PluginFQNToSchemaName(pluginFQN string) string

schemas in postgres are limited to 63 chars - the FQN may be longer than this, in which case trim the length and add a hash to the end to make unique

func SaveConnectionState

func SaveConnectionState(state ConnectionMap) error

func ValidatePlugins added in v0.2.0

func ValidatePlugins(updates ConnectionMap, plugins []*ConnectionPlugin) ([]*ValidationFailure, ConnectionMap, []*ConnectionPlugin)

Types

type Connection

type Connection struct {
	// connection name
	Name string
	// FQN of plugin
	Plugin string
	// unparsed HCL of plugin specific connection config
	Config string
}

Connection :: structure representing the partially parsed connection.

type ConnectionConfigMap added in v0.2.0

type ConnectionConfigMap struct {
	Connections map[string]*Connection
}

ConnectionConfigMap :: map of connection name to partially parsed connection config

func Load

func Load() (*ConnectionConfigMap, error)

type ConnectionMap

type ConnectionMap map[string]*connectionData

func GetConnectionState

func GetConnectionState(schemas []string) (ConnectionMap, error)

GetConnectionState :: load connection state file, and remove any connections which do not exist in the db

type ConnectionPlugin

type ConnectionPlugin struct {
	ConnectionName   string
	ConnectionConfig string
	PluginName       string
	Plugin           *grpc.PluginClient
	Schema           *proto.Schema
}

ConnectionPlugin :: structure representing an instance of a plugin NOTE: currently this corresponds to a single connection, i.e. we have 1 plugin instance per connection

func CreateConnectionPlugin

func CreateConnectionPlugin(options *ConnectionPluginOptions) (*ConnectionPlugin, error)

CreateConnectionPlugin :: instantiate a plugin for a connection, fetch schema and send connection config called by hub when

type ConnectionPluginOptions

type ConnectionPluginOptions struct {
	PluginFQN        string
	ConnectionName   string
	ConnectionConfig string
	DisableLogger    bool
}

ConnectionPluginOptions :: struct used as input to CreateConnectionPlugin - it contains all details necessary to instantiate a ConnectionPlugin

type ConnectionUpdates

type ConnectionUpdates struct {
	Update         ConnectionMap
	Delete         ConnectionMap
	MissingPlugins []string
	// the connections which will exist after the update
	RequiredConnections ConnectionMap
}

func GetConnectionsToUpdate

func GetConnectionsToUpdate(schemas []string) (*ConnectionUpdates, error)

GetConnectionsToUpdate :: returns updates to be made to the database to sync with connection config

type ValidationFailure added in v0.2.0

type ValidationFailure struct {
	Plugin             string
	ConnectionName     string
	Message            string
	ShouldDropIfExists bool
}

func (ValidationFailure) String added in v0.2.0

func (v ValidationFailure) String() string

Jump to

Keyboard shortcuts

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