modules

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package modules contains the base of the module system used in the hotstuff project. The module system allows us to use different implementations of key components, such as the crypto module or the consensus module, and ensures that a module has access to the other modules it depends on.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder is a helper for setting up client modules.

func NewBuilder

func NewBuilder(id hotstuff.ID) Builder

NewBuilder returns a new builder.

func (*Builder) Build

func (b *Builder) Build() *Modules

Build initializes all registered modules and returns the Modules object.

func (*Builder) Register

func (b *Builder) Register(modules ...interface{})

Register registers the modules with the builder.

type MetricsLogger

type MetricsLogger interface {
	Log(proto.Message)
	io.Closer
}

MetricsLogger logs data in protobuf message format.

func NewJSONLogger

func NewJSONLogger(wr io.Writer) (MetricsLogger, error)

NewJSONLogger returns a new metrics logger that logs to the specified writer.

func NopLogger

func NopLogger() MetricsLogger

NopLogger returns a metrics logger that discards any messages. This is useful for testing and other situations where metrics logging is disabled.

type Module

type Module interface {
	// InitModule gives the module access to the other modules.
	InitModule(mods *Modules)
}

Module is an interface for modules that need access to a client.

type Modules

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

Modules is the base of the module system. It contains only a few core modules that are shared between replicas and clients.

func (Modules) ID

func (mod Modules) ID() hotstuff.ID

ID returns the id of this client.

func (Modules) Logger

func (mod Modules) Logger() logging.Logger

Logger returns the logger.

func (Modules) MetricsEventLoop

func (mod Modules) MetricsEventLoop() *eventloop.EventLoop

MetricsEventLoop returns the metrics event loop. The metrics event loop is used for processing of measurement data.

func (Modules) MetricsLogger

func (mod Modules) MetricsLogger() MetricsLogger

MetricsLogger returns the metrics logger.

Jump to

Keyboard shortcuts

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