internal

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRegistry = NewRegistry()

Functions

func Assign

func Assign(hint Hint, spec *Specification)

func Register

func Register(h Handler)

Types

type Config

type Config interface {
	Complete(ctx Context) error
}

type ConfigPointer

type ConfigPointer[T any] interface {
	Config
	*T
}

type Context

type Context = cpi.Context

type Handler

type Handler interface {
	Algorithm() string
	Description() string
	DecodeConfig(data []byte) (Config, error)

	Merge(ctx Context, src runtime.RawValue, tgt *runtime.RawValue, cfg Config) (bool, error)
}

func New

func New[C any, L any, P ConfigPointer[C]](algo string, desc string, merger Merger[P, L]) Handler

type HandlerSupport

type HandlerSupport[C any, L any, P ConfigPointer[C]] struct {
	// contains filtered or unexported fields
}

HandlerSupport is a basic support for label merge handlers.

func (*HandlerSupport[C, L, P]) Algorithm

func (h *HandlerSupport[C, L, P]) Algorithm() string

func (HandlerSupport[C, L, P]) DecodeConfig

func (h HandlerSupport[C, L, P]) DecodeConfig(data []byte) (Config, error)

func (*HandlerSupport[C, L, P]) Description

func (h *HandlerSupport[C, L, P]) Description() string

func (*HandlerSupport[C, L, P]) Merge

func (h *HandlerSupport[C, L, P]) Merge(ctx Context, local Value, inbound *Value, cfg Config) (bool, error)

type Handlers

type Handlers = map[string]Handler

type Hint

type Hint string

type MergeHandlerAssignments

type MergeHandlerAssignments = map[Hint]*Specification

type Merger

type Merger[C, T any] func(ctx Context, cfg C, local T, target *T) (bool, error)

type Registry

type Registry interface {
	RegisterHandler(h Handler)
	AssignHandler(hint Hint, spec *Specification)

	GetHandler(name string) Handler
	GetAssignment(hint Hint) *Specification

	GetHandlers() Handlers
	GetAssignments() MergeHandlerAssignments

	Copy() Registry
}

func NewRegistry

func NewRegistry(base ...Registry) Registry

type Value

type Value = runtime.RawValue

Jump to

Keyboard shortcuts

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