setup

package
v1.24.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package setup provides proper setup of DocDB components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SetupOpts

type SetupOpts struct {
	Logger        *slog.Logger
	StateProvider *state.Provider
	Metrics       *middleware.Metrics

	// DocDB handler
	PostgreSQLURL          string
	Auth                   bool
	ReplSetName            string
	SessionCleanupInterval time.Duration

	// Proxy handler
	ProxyAddr        string
	ProxyTLSCertFile string
	ProxyTLSKeyFile  string
	ProxyTLSCAFile   string

	// Wire protocol listener
	TCPAddr        string // empty value disables TCP listener
	UnixAddr       string // empty value disables Unix listener
	TLSAddr        string // empty value disables TLS listener
	TLSCertFile    string
	TLSKeyFile     string
	TLSCAFile      string
	Mode           middleware.Mode
	TestRecordsDir string // empty value disables recording

	// DataAPI listener
	DataAPIAddr string // empty value disables Data API listener

	// MCPAddr listener
	MCPAddr string // empty value disables MCP listener

	// ZAP listener
	ZAPAddr string // empty value disables ZAP binary protocol listener
}

SetupOpts represents options for creating and setting up DocDB components.

type SetupResult

type SetupResult struct {
	WireListener    *clientconn.Listener
	DataAPIListener *dataapi.Listener
	MCPListener     *mcp.Listener
	ZAPListener     *internalzap.Listener
	// contains filtered or unexported fields
}

SetupResult represents Setup result.

func Setup

func Setup(ctx context.Context, opts *SetupOpts) *SetupResult

Setup creates and sets up:

It does not change the global state or creates components that are different in tests. For example, it does not:

  • change global logger (it is different in tests);
  • set up state provider (it is different in tests);
  • set up telemetry reporter (it is not needed in tests);
  • set up debug handler (it is global and uses the global Prometheus gatherer);
  • set up OpenTelemetry trace exporter (it is global).

It returns nil if any of the components could not be created. The error is already logged, so the caller may just exit.

func (*SetupResult) Collect

func (sr *SetupResult) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.

func (*SetupResult) Describe

func (sr *SetupResult) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.

func (*SetupResult) Run

func (sr *SetupResult) Run(ctx context.Context)

Run runs all components until ctx is canceled.

When this method returns, all components are stopped.

Jump to

Keyboard shortcuts

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