hpi

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package hpi contains the Handler Programming Interface for value merge handlers

Index

Constants

View Source
const ATTR_MERGE_HANDLERS = "github.com/open-component-model/ocm/pkg/contexts/ocm/valuemergehandlers"
View Source
const KIND_VALUE_MERGE_ALGORITHM = metav1.KIND_VALUE_MERGE_ALGORITHM

Variables

View Source
var REALM = ocmlog.DefineSubRealm("value marge handling", "valuemerge")

Functions

func Assign

func Assign(hint Hint, spec *Specification)

func GenericMerge

func GenericMerge[T any](ctx Context, m *Specification, hint string, local T, inbound T) (bool, T, error)

func Merge

func Merge(ctx Context, m *Specification, hint Hint, local Value, inbound *Value) (bool, error)

Merge merges two value using the given merge specification. The hint describes a merge hint if no algorithm is specified. It used the format <string>[@<version>]. If used the is looks for an assignment for this hint, first with version and the without version.

func Register

func Register(h Handler)

func SetFor

func SetFor(ctx datacontext.Context, registry Registry)

Types

type Config

type Config = internal.Config

type Context

type Context = internal.Context

type EmptyConfig

type EmptyConfig struct{}

func (*EmptyConfig) Complete

func (c *EmptyConfig) Complete(ctx Context) error

type Handler

type Handler = internal.Handler

func New

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

type Hint

type Hint = internal.Hint

func LabelHint

func LabelHint(name string, optversion ...string) Hint

type Merger

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

type Registry

type Registry = internal.Registry

func For

func For(ctx cpi.ContextProvider) Registry

func NewRegistry

func NewRegistry(base ...Registry) Registry

type Specification

type Specification = internal.Specification

func NewSpecification

func NewSpecification(algo string, cfg ...Config) (*Specification, error)

type Value

type Value = internal.Value

func AsValue

func AsValue(v interface{}) (*Value, error)

Jump to

Keyboard shortcuts

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