registrations

package
v0.0.0-...-877fc11 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package registrations provides a hierarchical namespace for denoting any kind of handlers to be registered on some target. Handlers are denoted by names evaluated by HandlerRegistrationHandler Such a registration handler is responsible vor a complete sub namespace and may delegate the evaluation to nested handler mounted on a sub namespace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeAnyConfig

func DecodeAnyConfig(config interface{}) (json.RawMessage, error)

func DecodeConfig

func DecodeConfig[T any](config interface{}, d ...Decoder) (*T, error)

func DecodeDefaultedConfig

func DecodeDefaultedConfig[T any](config interface{}, d ...Decoder) (*T, error)

Types

type Decoder

type Decoder func(data []byte, unmarshaller runtime.Unmarshaler) (interface{}, error)

type HandlerConfig

type HandlerConfig interface{}

type HandlerInfo

type HandlerInfo struct {
	Name        string
	ShortDesc   string
	Description string
	Node        bool
}

type HandlerInfos

type HandlerInfos []HandlerInfo

func NewLeafHandlerInfo

func NewLeafHandlerInfo(short, desc string) HandlerInfos

func NewNodeHandlerInfo

func NewNodeHandlerInfo(short, desc string) HandlerInfos

func (HandlerInfos) Description

func (h HandlerInfos) Description(i int) string

func (HandlerInfos) Key

func (h HandlerInfos) Key(i int) string

func (HandlerInfos) Size

func (h HandlerInfos) Size() int

type HandlerRegistrationHandler

type HandlerRegistrationHandler[T any, O any] interface {
	RegisterByName(handler string, target T, config HandlerConfig, opts ...O) (bool, error)
	GetHandlers(T) HandlerInfos
}

type HandlerRegistrationRegistry

type HandlerRegistrationRegistry[T any, O any] interface {
	HandlerRegistrationRegistryAccess[T, O]

	GetAllRegistrationHandlers() []*RegistrationHandlerInfo[T, O]
	Copy() HandlerRegistrationRegistry[T, O]
}

func NewHandlerRegistrationRegistry

func NewHandlerRegistrationRegistry[T any, O any](base ...HandlerRegistrationRegistry[T, O]) HandlerRegistrationRegistry[T, O]

type HandlerRegistrationRegistryAccess

type HandlerRegistrationRegistryAccess[T any, O any] interface {
	HandlerRegistrationHandler[T, O]
	RegisterRegistrationHandler(path string, handler HandlerRegistrationHandler[T, O])
	GetRegistrationHandlers(name string) []*RegistrationHandlerInfo[T, O]
}

type NamePath

type NamePath []string

func NewNamePath

func NewNamePath(path string) NamePath

func (NamePath) Compare

func (p NamePath) Compare(o NamePath) int

func (NamePath) IsPrefixOf

func (p NamePath) IsPrefixOf(o NamePath) bool

func (NamePath) String

func (p NamePath) String() string

type RegistrationHandlerInfo

type RegistrationHandlerInfo[T any, O any] struct {
	// contains filtered or unexported fields
}

func NewRegistrationHandlerInfo

func NewRegistrationHandlerInfo[T any, O any](path string, handler HandlerRegistrationHandler[T, O]) *RegistrationHandlerInfo[T, O]

func (*RegistrationHandlerInfo[T, O]) GetHandlers

func (i *RegistrationHandlerInfo[T, O]) GetHandlers(target T) HandlerInfos

func (*RegistrationHandlerInfo[T, O]) RegisterByName

func (i *RegistrationHandlerInfo[T, O]) RegisterByName(handler string, target T, config HandlerConfig, opts ...O) (bool, error)

Jump to

Keyboard shortcuts

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