dbrepl

package
v0.0.0-...-f88c608 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Manifold

func Manifold(config ManifoldConfig) dependency.Manifold

Manifold returns a dependency manifold that runs the dbaccessor worker, using the resource names defined in the supplied config.

func NewWorker

func NewWorker(cfg WorkerConfig) (*dbReplWorker, error)

NewWorker creates a new dbaccessor worker.

Types

type DBGetter

type DBGetter interface {
	// GetDB returns a sql.DB reference for the dqlite-backed database that
	// contains the data for the specified namespace.
	// A NotFound error is returned if the worker is unaware of the requested DB.
	GetDB(namespace string) (database.TxnRunner, error)
}

DBGetter describes the ability to supply a sql.DB reference for a particular database.

type ManifoldConfig

type ManifoldConfig struct {
	DBReplAccessorName string
	Logger             logger.Logger
	Stdout             io.Writer
	Stderr             io.Writer
	Stdin              io.Reader
}

ManifoldConfig contains: - The names of other manifolds on which the DB accessor depends. - Other dependencies from ManifoldsConfig required by the worker.

func (ManifoldConfig) Validate

func (cfg ManifoldConfig) Validate() error

type NodeManager

type NodeManager interface {
	// ClusterServers returns the node information for
	// Dqlite nodes configured to be in the cluster.
	ClusterServers(context.Context) ([]dqlite.NodeInfo, error)

	// WithTLSDialer returns a dbApp that can be used to connect to the Dqlite
	// cluster.
	WithTLSDialer(ctx context.Context) (client.DialFunc, error)
}

NodeManager creates Dqlite `App` initialisation arguments and options.

type WorkerConfig

type WorkerConfig struct {
	DBGetter database.DBGetter
	Logger   logger.Logger
	Stdout   io.Writer
	Stderr   io.Writer
	Stdin    io.Reader
}

WorkerConfig encapsulates the configuration options for the dbaccessor worker.

func (*WorkerConfig) Validate

func (c *WorkerConfig) Validate() error

Validate ensures that the config values are valid.

Jump to

Keyboard shortcuts

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