backendruntime

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package backendruntime provides a shared, thread-safe named-lookup registry for provider runtime configs (API credentials, exec mode).

truenasprovider, proxmoxprovider, and dockerprovider each hold connection details for their backends.<kind>[] config entries, keyed by name, so exec-time code (SSH dial, tunnels, VNC, KV bridge) can resolve a hosts.Record's tagged backend name back to live credentials. Before this package existed, all three providers hand-rolled an identical mutex+slice+linear-scan registry; Registry concentrates that one implementation instead of leaving it duplicated three times.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry[T any] struct {
	// contains filtered or unexported fields
}

Registry is a thread-safe, name-indexed store for a provider's runtime configs, rebuilt wholesale on every config reload via Reconfigure.

func New

func New[T any](nameOf func(T) string) *Registry[T]

New creates a Registry that extracts each item's name via nameOf.

func (*Registry[T]) ByName

func (r *Registry[T]) ByName(name string) (T, bool)

ByName returns the entry matching name (empty name matches the first entry).

func (*Registry[T]) Reconfigure

func (r *Registry[T]) Reconfigure(items []T)

Reconfigure atomically replaces the registry's contents.

Jump to

Keyboard shortcuts

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