Versions in this module Expand all Collapse all v0 v0.3.0 Sep 4, 2018 Changes in this version + type Config struct + CacheSize int + HeartbeatTimeout time.Duration + Logger *logrus.Logger + StorePath string + StoreType string + SyncLimit int + TCPTimeout time.Duration + func DefaultConfig() *Config + func NewConfig(heartbeat time.Duration, timeout time.Duration, cacheSize int, syncLimit int, ...) *Config + func TestConfig(t *testing.T) *Config + type ControlTimer struct + func NewControlTimer(timerFactory timerFactory) *ControlTimer + func NewRandomControlTimer(base time.Duration) *ControlTimer + func (c *ControlTimer) Run() + func (c *ControlTimer) Shutdown() + type Core struct + Head string + Seq int + func NewCore(id int, key *ecdsa.PrivateKey, participants map[string]int, store hg.Store, ...) Core + func (c *Core) AddBlockSignature(bs hg.BlockSignature) + func (c *Core) AddSelfEvent(otherHead string) error + func (c *Core) AddTransactions(txs [][]byte) + func (c *Core) Bootstrap() error + func (c *Core) EventDiff(known map[int]int) (events []hg.Event, err error) + func (c *Core) FastForward(peer string, block hg.Block, frame hg.Frame) error + func (c *Core) FromWire(wireEvents []hg.WireEvent) ([]hg.Event, error) + func (c *Core) GetAnchorBlockWithFrame() (hg.Block, hg.Frame, error) + func (c *Core) GetConsensusEvents() []string + func (c *Core) GetConsensusEventsCount() int + func (c *Core) GetConsensusTransactions() ([][]byte, error) + func (c *Core) GetConsensusTransactionsCount() int + func (c *Core) GetEvent(hash string) (hg.Event, error) + func (c *Core) GetEventTransactions(hash string) ([][]byte, error) + func (c *Core) GetHead() (hg.Event, error) + func (c *Core) GetLastBlockIndex() int + func (c *Core) GetLastCommitedRoundEventsCount() int + func (c *Core) GetLastConsensusRoundIndex() *int + func (c *Core) GetPendingLoadedEvents() int + func (c *Core) GetUndeterminedEvents() []string + func (c *Core) HexID() string + func (c *Core) ID() int + func (c *Core) InsertEvent(event hg.Event, setWireInfo bool) error + func (c *Core) KnownEvents() map[int]int + func (c *Core) NeedGossip() bool + func (c *Core) OverSyncLimit(knownEvents map[int]int, syncLimit int) bool + func (c *Core) PubKey() []byte + func (c *Core) RunConsensus() error + func (c *Core) SetHeadAndSeq() error + func (c *Core) SignAndInsertSelfEvent(event hg.Event) error + func (c *Core) SignBlock(block hg.Block) (hg.BlockSignature, error) + func (c *Core) Sync(unknownEvents []hg.WireEvent) error + func (c *Core) ToWire(events []hg.Event) ([]hg.WireEvent, error) + type Node struct + func NewNode(conf *Config, id int, key *ecdsa.PrivateKey, participants []net.Peer, ...) *Node + func (n *Node) GetBlock(blockIndex int) (hg.Block, error) + func (n *Node) GetStats() map[string]string + func (n *Node) Init(bootstrap bool) error + func (n *Node) Run(gossip bool) + func (n *Node) RunAsync(gossip bool) + func (n *Node) Shutdown() + func (n *Node) SyncRate() float64 + type NodeState uint32 + const Babbling + const CatchingUp + const Shutdown + func (s NodeState) String() string + type PeerSelector interface + Next func() net.Peer + Peers func() []net.Peer + UpdateLast func(peer string) + type RandomPeerSelector struct + func NewRandomPeerSelector(participants []net.Peer, localAddr string) *RandomPeerSelector + func (ps *RandomPeerSelector) Next() net.Peer + func (ps *RandomPeerSelector) Peers() []net.Peer + func (ps *RandomPeerSelector) UpdateLast(peer string)