consensusspecs

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePreset

func ParsePreset(fork string, data []byte) ([]types.SpecConstant, error)

ParsePreset parses a YAML preset file into a slice of SpecConstants.

func ParseSpec

func ParseSpec(
	fork, topic string,
	data []byte,
	repository, ref string,
) types.ConsensusSpec

ParseSpec parses a consensus-specs markdown document into a ConsensusSpec.

Types

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages a collection of parsed consensus specs with disk caching.

func NewRegistry

func NewRegistry(
	ctx context.Context,
	log logrus.FieldLogger,
	cfg config.ConsensusSpecsConfig,
	cacheDir string,
) (*Registry, error)

NewRegistry creates a consensus specs registry, fetching from GitHub if the cache is stale.

func (*Registry) AllConstants

func (r *Registry) AllConstants() []types.SpecConstant

AllConstants returns a copy of all constants.

func (*Registry) AllSpecs

func (r *Registry) AllSpecs() []types.ConsensusSpec

AllSpecs returns a copy of all specs.

func (*Registry) ConstantCount

func (r *Registry) ConstantCount() int

ConstantCount returns the number of constants.

func (*Registry) Forks

func (r *Registry) Forks() []string

Forks returns sorted unique fork names across all specs.

func (*Registry) GetConstant

func (r *Registry) GetConstant(name string, fork string) (types.SpecConstant, bool)

GetConstant finds a constant by name, optionally filtered to a specific fork. When fork is empty, returns the constant from the latest fork that defines it.

func (*Registry) GetSpec

func (r *Registry) GetSpec(fork, topic string) (types.ConsensusSpec, bool)

GetSpec finds a spec by fork and topic.

func (*Registry) Refresh

func (r *Registry) Refresh(ctx context.Context) error

Refresh re-fetches consensus specs from GitHub.

func (*Registry) SpecCount

func (r *Registry) SpecCount() int

SpecCount returns the number of spec documents.

func (*Registry) Topics

func (r *Registry) Topics() []string

Topics returns sorted unique topic names across all specs.

Jump to

Keyboard shortcuts

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