Documentation
¶
Index ¶
- func ParsePreset(fork string, data []byte) ([]types.SpecConstant, error)
- func ParseSpec(fork, topic string, data []byte, repository, ref string) types.ConsensusSpec
- type Registry
- func (r *Registry) AllConstants() []types.SpecConstant
- func (r *Registry) AllSpecs() []types.ConsensusSpec
- func (r *Registry) ConstantCount() int
- func (r *Registry) Forks() []string
- func (r *Registry) GetConstant(name string, fork string) (types.SpecConstant, bool)
- func (r *Registry) GetSpec(fork, topic string) (types.ConsensusSpec, bool)
- func (r *Registry) Refresh(ctx context.Context) error
- func (r *Registry) SpecCount() int
- func (r *Registry) Topics() []string
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.
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 ¶
ConstantCount returns the number of constants.
func (*Registry) GetConstant ¶
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.
Click to show internal directories.
Click to hide internal directories.