repository

package
v1.27.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package repository contains the plugin discovery and connection pooling feature of CNPG

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrPluginAlreadyRegistered

type ErrPluginAlreadyRegistered struct {
	Name string
}

ErrPluginAlreadyRegistered is raised when a plugin is being registered but its configuration is already attached to the pool

func (*ErrPluginAlreadyRegistered) Error

Error implements the error interface

type ErrUnknownPlugin

type ErrUnknownPlugin struct {
	Name string
}

ErrUnknownPlugin is raised when requesting a connection to a plugin that is not known

func (*ErrUnknownPlugin) Error

func (e *ErrUnknownPlugin) Error() string

Error implements the error interface

type Interface

type Interface interface {
	// ForgetPlugin closes every connection to the plugin with the passed name
	// and forgets its discovery info.
	// This operation is synchronous and blocks until every connection is closed.
	// If the plugin was not available in the repository, this is a no-op.
	ForgetPlugin(name string)

	// RegisterRemotePlugin registers a plugin available on a remote
	// TCP entrypoint.
	RegisterRemotePlugin(name string, address string, tlsConfig *tls.Config) error

	// RegisterUnixSocketPluginsInPath scans the passed directory
	// for plugins that are deployed with unix sockets.
	// Return the list of loaded plugin names
	RegisterUnixSocketPluginsInPath(pluginsPath string) ([]string, error)

	// GetConnection gets a connection to the plugin with specified name
	GetConnection(ctx context.Context, name string) (connection.Interface, error)

	// Close closes all the connections to the plugins
	Close()
}

Interface is the interface to use a plugin repository

func New

func New() Interface

New creates a new plugin repository

Jump to

Keyboard shortcuts

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