composer

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetaKeyOrder = "order"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Composer added in v0.8.0

type Composer interface {
	http.Handler
	adminext.FlowFetcher
}

Composer is an http.Handler that exposes metadata about its FlowComponent chain.

func New

func New(opts *Opts) Composer

type ContextKey added in v0.8.0

type ContextKey string
const (
	// TargetContextKey used by the forwarder to get the target backend.
	TargetContextKey ContextKey = "krb.target"

	// BackendContextKey used to store the backend name.
	BackendContextKey ContextKey = "krb.backend"
)

type CustomHandlerFunc added in v0.8.0

type CustomHandlerFunc func(FlowComponent, http.ResponseWriter, *http.Request)

type Dummy added in v0.8.0

type Dummy struct {
	CustomHandler CustomHandlerFunc
	// Returned by Order() int. Don't import the custom types package here to avoid circular
	// imports, so we just use an int and interpret it as the order.
	O int
	// contains filtered or unexported fields
}

Dummy can be used to replace components with a block that just forwards whatever request it's called to handle. This is useful to be able to easily disable certain components while keeping the structure the same.

func (*Dummy) GetMeta added in v0.8.0

func (d *Dummy) GetMeta() []adminapi.FlowMeta

func (*Dummy) Next added in v0.8.0

func (d *Dummy) Next(next FlowComponent)

func (*Dummy) Order added in v0.8.0

func (d *Dummy) Order() int

func (*Dummy) ServeHTTP added in v0.8.0

func (d *Dummy) ServeHTTP(w http.ResponseWriter, req *http.Request)

type FlowComponent added in v0.8.0

type FlowComponent interface {
	http.Handler

	Next(FlowComponent)
	GetMeta() []adminapi.FlowMeta
}

type FlowMeta added in v0.8.0

type FlowMeta struct {
	// Name is the name of the FlowComponent.
	Name string `json:"name"`
	// Data holds dynamic key-value pairs associated with this component.
	Data map[string]any `json:"data"`
}

FlowMeta holds metadata about a FlowComponent.

type Opts

type Opts struct {
	Observability FlowComponent
	Router        FlowComponent
	Custom        FlowComponent
	Forwarder     FlowComponent
}

Directories

Path Synopsis
nolint: mnd
nolint: mnd

Jump to

Keyboard shortcuts

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