dataservermanager

package
v0.0.55 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Step

func Step(b *wait.Backoff) time.Duration

Step returns a duration using the backoff parameters.

Types

type DSConnManager

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

DSConnManager maintains a long-lived client connection to a dataserver and broadcasts Up/Down transitions to subscribers.

IMPORTANT: reconcilers should never create dsclient.Client directly. They should use this manager (or a higher-level runtime manager).

func New

New creates a DSConnManager for a single dataserver address/config.

func (*DSConnManager) AddToManager

func (m *DSConnManager) AddToManager(mgr ctrl.Manager) error

AddToManager registers the manager as a controller-runtime Runnable. Call this from main during startup.

func (*DSConnManager) Client

func (m *DSConnManager) Client() dsclient.Client

Client returns the current client if Up; otherwise nil.

func (*DSConnManager) Start

func (m *DSConnManager) Start(ctx context.Context) error

Start implements controller-runtime Runnable.

func (*DSConnManager) State

func (m *DSConnManager) State() DSState

State returns the last known DS state.

func (*DSConnManager) Stop

func (m *DSConnManager) Stop()

Stop can be used if you run it outside controller-runtime.

func (*DSConnManager) Subscribe

func (m *DSConnManager) Subscribe(buffer int) (<-chan Event, func())

Subscribe returns a channel that receives state transition events. Caller should call the returned cancel function to unsubscribe.

func (*DSConnManager) WaitForUp

func (m *DSConnManager) WaitForUp(ctx context.Context) error

WaitForUp blocks until the dataserver is Up or ctx is done.

type DSState

type DSState string

DSState represents connectivity to the dataserver.

const (
	DSDown DSState = "Down"
	DSUp   DSState = "Up"
)

type Event

type Event struct {
	State DSState
	Err   error // last error on transitions to Down (optional)
	At    time.Time
}

Event is what subscribers receive.

Jump to

Keyboard shortcuts

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