plugin

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Descriptor added in v0.6.5

func Descriptor(id string) (spi.PluginDescriptor, bool)

Descriptor returns the descriptor for a plugin ID.

func Descriptors added in v0.6.5

func Descriptors() map[string]spi.PluginDescriptor

Descriptors returns all known descriptors.

func IDs added in v0.6.5

func IDs() []string

IDs returns the list of registered plugin IDs.

func Register added in v0.6.5

func Register(id string, f Factory, d spi.PluginDescriptor)

Register adds a factory and descriptor for a given plugin ID.

Types

type Factory added in v0.6.5

type Factory func(
	state spi.ServerState,
	connect http.Handler,
	workers spi.WorkerRegistry,
	sched spi.Scheduler,
	metrics spi.Metrics,
	stateProvider func() any,
	version, sha, date string,
	opts spi.Options,
	authMW spi.Middleware,
) spi.Plugin

Factory is the common constructor for server extensions.

func Get added in v0.6.5

func Get(id string) (Factory, bool)

Get returns a factory by ID.

type Plugin

type Plugin = spi.Plugin

Plugin is implemented by all plugins.

type PromAdapter added in v0.6.5

type PromAdapter struct{ *prometheus.Registry }

PromAdapter adapts a Prometheus registry to the SPI MetricsRegistry interface.

func (PromAdapter) MustRegister added in v0.6.5

func (r PromAdapter) MustRegister(cs ...spi.Collector)

type Registry

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

Registry holds loaded plugins and their optional capabilities.

func Load

func Load(parent chi.Router, preg *prometheus.Registry, state spi.StateRegistry, plugins []Plugin) *Registry

Load initializes plugins and returns a Registry describing their capabilities.

func (*Registry) Plugins

func (r *Registry) Plugins() []Plugin

Plugins returns all loaded plugins.

func (*Registry) WorkerProviders

func (r *Registry) WorkerProviders() []WorkerProvider

WorkerProviders returns plugins that implement WorkerProvider.

type SurfaceMount

type SurfaceMount struct {
	Path    string
	Router  chi.Router
	Metrics *prometheus.Registry
	State   spi.StateRegistry
}

SurfaceMount represents a mounted plugin surface.

func RegisterSurface

func RegisterSurface(parent chi.Router, p Plugin, preg *prometheus.Registry, state spi.StateRegistry) SurfaceMount

RegisterSurface mounts a plugin under /api/{id} and wires optional capabilities.

type WorkerProvider

type WorkerProvider = spi.WorkerProvider

WorkerProvider is implemented by plugins that handle load-balanced workers.

Jump to

Keyboard shortcuts

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