Documentation
¶
Index ¶
- Variables
- type Node
- func (n *Node) Run(exitC <-chan struct{}, tickC <-chan time.Time) error
- func (n *Node) Status(ctx context.Context) (*statuspb.NodeStatus, error)
- func (n *Node) Step(ctx context.Context, source t.NodeID, msg *messagepb.Message) error
- func (n *Node) SubmitRequest(ctx context.Context, clientID t.ClientID, reqNo t.ReqNo, data []byte, ...) error
- type NodeConfig
Constants ¶
This section is empty.
Variables ¶
var ErrStopped = fmt.Errorf("stopped at caller request")
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { ID t.NodeID // Protocol-level node ID Config *NodeConfig // Node-level (protocol-independent) configuration, like buffer sizes, logging, ... // contains filtered or unexported fields }
Node is the local instance of MirBFT and the application's interface to the mirbft library.
func NewNode ¶
NewNode creates a new node with numeric ID id. The config parameter specifies Node-level (protocol-independent) configuration, like buffer sizes, logging, ... The modules parameter must contain initialized, ready-to-use modules that the new Node will use.
func (*Node) Run ¶
Run starts the Node. First, it loads the contents of the WAL and enqueues all its contents for processing. This makes sure that the WAL events end up first in all the modules' processing queues. Then it adds an Init event to the work items, giving the modules the possibility to perform additional initialization based on the state recovered from the WAL. Run then launches the processing of incoming messages, time ticks, and internal events. The node stops when exitC is closed. Logical time ticks need to be written to tickC by the calling code. The function call is blocking and only returns when the node stops.
func (*Node) Status ¶
Status returns a static snapshot in time of the internal state of the Node. TODO: Currently a call to Status blocks until the node is stopped, as obtaining status is not yet implemented.
Also change the return type to be a protobuf object that contains a field for each module with module-specific contents.
func (*Node) Step ¶
Step inserts a new incoming message msg in the Node. The source parameter specifies the numeric ID of the sender of the message. The Node assumes the message to be authenticated and it is the caller's responsibility to make sure that msg has indeed been sent by source, for example by using an authenticated communication channel (e.g. TLS) with the source node.
func (*Node) SubmitRequest ¶
func (n *Node) SubmitRequest( ctx context.Context, clientID t.ClientID, reqNo t.ReqNo, data []byte, authenticator []byte) error
SubmitRequest submits a new client request to the Node. clientID and reqNo uniquely identify the request. data constitutes the (opaque) payload of the request. SubmitRequest is safe to be called concurrently by multiple threads.
type NodeConfig ¶
The NodeConfig struct represents configuration parameters of the node that are independent of the protocol the Node is executing. NodeConfig only contains protocol-independent parameters. Protocol-specific parameters should be specified when instantiating the protocol implementation as one of the Node's modules.
func DefaultNodeConfig ¶
func DefaultNodeConfig() *NodeConfig
DefaultNodeConfig returns the default node configuration. It can be used as a base for creating more specific configurations when instantiating a Node.
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
pkg
|
|
crypto
Package crypto provides an implementation of the Crypto module.
|
Package crypto provides an implementation of the Crypto module. |
iss
Package iss contains the implementation of the ISS protocol, the new generation of MirBFT.
|
Package iss contains the implementation of the ISS protocol, the new generation of MirBFT. |
messagebuffer
Package messagebuffer implements a backlog for messages that have been received but cannot yet be processed.
|
Package messagebuffer implements a backlog for messages that have been received but cannot yet be processed. |
modules
Package modules provides interfaces of modules that serve as building blocks of a Node.
|
Package modules provides interfaces of modules that serve as building blocks of a Node. |
reqstore
Package reqstore is an implementation of the RequestStore utilized by the samples.
|
Package reqstore is an implementation of the RequestStore utilized by the samples. |
simplewal
Package simplewal is a basic WAL implementation meant to be the first 'real' WAL option for mirbft.
|
Package simplewal is a basic WAL implementation meant to be the first 'real' WAL option for mirbft. |
samples
|
|