simulation

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Wg     *sync.WaitGroup
	SendCb func() // SendCb is called before sending a msg iff not nil.
	RecvCb func() // RecvCb is called after handling a msg iff not nil.
	// contains filtered or unexported fields
}

Node is used in the simulations and represents a node in the network. A Node can be connected to other peers. Connections are unidirectional, meaning that if NodeA is connected to NodeB, NodeB will receive messages from NodeA.

func NewNode

func NewNode(pub wendy.Pubkey, peers ...*Node) *Node

func (*Node) AddPeer

func (n *Node) AddPeer(peer *Node)

func (*Node) AddPeers

func (n *Node) AddPeers(peers ...*Node)

func (*Node) AddTx

func (n *Node) AddTx(tx wendy.Tx)

func (*Node) Log

func (n *Node) Log(msg string, args ...interface{})

func (*Node) WithDebug

func (n *Node) WithDebug(fn NodeDebugFn) *Node

type NodeDebugFn

type NodeDebugFn func(*Node, string) bool

Jump to

Keyboard shortcuts

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