Documentation
¶
Overview ¶
Package familyregistry provides a generic, thread-safe registry mapping a string key (typically a chain-selectors family) to a per-family implementation.
Changeset packages use it to register family-specific operations sequences and optional verify hooks without duplicating registry boilerplate.
Index ¶
- type Registration
- type Registry
- func (r *Registry[S, C]) Get(family string) (Registration[S, C], error)
- func (r *Registry[S, C]) Register(reg Registration[S, C])
- func (r *Registry[S, C]) RegisteredFamilies() []string
- func (r *Registry[S, C]) SequenceForChainSelector(chainSelector uint64) (*S, error)
- func (r *Registry[S, C]) SequenceForFamily(family string) (*S, error)
- func (r *Registry[S, C]) VerifyForFamily(family string, env cldf.Environment, chains []C) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registration ¶
type Registration[S any, C any] struct { // Family is the chain-selectors family string (e.g. chainselectors.FamilyEVM). Family string // Sequence executes the per-chain operations sequence. Sequence *S // Verify performs family-specific validation across all chains in the input. // It is called during VerifyPreconditions. Optional — nil means no extra checks. Verify func(env cldf.Environment, chains []C) error }
Registration describes one family's implementation, where S is the operations sequence type and C is the per-chain input type.
type Registry ¶
Registry is a thread-safe map of family to Registration.
func (*Registry[S, C]) Get ¶
func (r *Registry[S, C]) Get(family string) (Registration[S, C], error)
Get returns the Registration for a chain family, or an error listing the registered families when the family is not found.
func (*Registry[S, C]) Register ¶
func (r *Registry[S, C]) Register(reg Registration[S, C])
Register adds a family implementation. It panics if the family string is empty, Sequence is nil, or the family is already registered — all of which indicate a programming error at startup.
func (*Registry[S, C]) RegisteredFamilies ¶
RegisteredFamilies returns the sorted list of families with a registration.
func (*Registry[S, C]) SequenceForChainSelector ¶
SequenceForChainSelector returns the registered sequence for a chain selector.
func (*Registry[S, C]) SequenceForFamily ¶
SequenceForFamily returns the registered sequence for a chain family.
func (*Registry[S, C]) VerifyForFamily ¶
func (r *Registry[S, C]) VerifyForFamily(family string, env cldf.Environment, chains []C) error
VerifyForFamily runs the registered family verify hook, if any. It returns nil when the family registers no hook, and wraps hook errors with the family.