Documentation
¶
Index ¶
- type Config
- type ControlTimer
- type Core
- func (c *Core) AddSelfEvent(otherHead string) error
- func (c *Core) AddTransactions(txs [][]byte)
- func (c *Core) Bootstrap() error
- func (c *Core) Commit(block *hg.Block) error
- func (c *Core) EventDiff(known map[uint32]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() uint32
- func (c *Core) InsertEventAndRunConsensus(event *hg.Event, setWireInfo bool) error
- func (c *Core) KnownEvents() map[uint32]int
- func (c *Core) OverSyncLimit(knownEvents map[uint32]int, syncLimit int) bool
- func (c *Core) ProcessSigPool() error
- func (c *Core) PubKey() []byte
- func (c *Core) RecordHeads() 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(fromID uint32, unknownEvents []hg.WireEvent) error
- func (c *Core) ToWire(events []*hg.Event) ([]hg.WireEvent, error)
- type Graph
- type Infos
- type Node
- func (n *Node) GetBlock(blockIndex int) (*hg.Block, error)
- func (n *Node) GetEvents() (map[uint32]int, error)
- func (n *Node) GetPeers() []*peers.Peer
- func (n *Node) GetStats() map[string]string
- func (n *Node) ID() uint32
- func (n *Node) Init() error
- func (n *Node) Run(gossip bool)
- func (n *Node) RunAsync(gossip bool)
- func (n *Node) Shutdown()
- func (n *Node) SyncRate() float64
- type NodeState
- type PeerSelector
- type RandomPeerSelector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
HeartbeatTimeout time.Duration `mapstructure:"heartbeat"`
TCPTimeout time.Duration `mapstructure:"timeout"`
CacheSize int `mapstructure:"cache-size"`
SyncLimit int `mapstructure:"sync-limit"`
Logger *logrus.Logger
}
func DefaultConfig ¶
func DefaultConfig() *Config
func TestConfig ¶
type ControlTimer ¶
type ControlTimer struct {
// contains filtered or unexported fields
}
func NewControlTimer ¶
func NewControlTimer(timerFactory timerFactory) *ControlTimer
func NewRandomControlTimer ¶
func NewRandomControlTimer() *ControlTimer
func (*ControlTimer) Run ¶
func (c *ControlTimer) Run(init time.Duration)
func (*ControlTimer) Shutdown ¶
func (c *ControlTimer) Shutdown()
type Core ¶
type Core struct {
//Hash and Index of this instance's head Event
Head string
Seq int
//AcceptedRound is the first Round to which this peer belongs. A node will
//not create SelfEvents before reaching AcceptedRound.
AcceptedRound int
// contains filtered or unexported fields
}
func (*Core) AddSelfEvent ¶
func (*Core) AddTransactions ¶
func (*Core) FastForward ¶
func (*Core) GetAnchorBlockWithFrame ¶
func (*Core) GetConsensusEvents ¶
func (*Core) GetConsensusEventsCount ¶
func (*Core) GetConsensusTransactions ¶
func (*Core) GetConsensusTransactionsCount ¶
func (*Core) GetEventTransactions ¶
func (*Core) GetLastBlockIndex ¶
func (*Core) GetLastCommitedRoundEventsCount ¶
func (*Core) GetLastConsensusRoundIndex ¶
func (*Core) GetPendingLoadedEvents ¶
func (*Core) GetUndeterminedEvents ¶
func (*Core) InsertEventAndRunConsensus ¶ added in v0.4.1
func (*Core) KnownEvents ¶
func (*Core) OverSyncLimit ¶
func (*Core) ProcessSigPool ¶ added in v0.4.1
func (*Core) RecordHeads ¶ added in v0.4.1
func (*Core) SetHeadAndSeq ¶
type Graph ¶ added in v0.4.1
type Graph struct {
*Node
}
func (*Graph) GetParticipantEvents ¶ added in v0.4.1
type NodeState ¶
type NodeState uint32
NodeState captures the state of a Babble node: Babbling, CatchingUp, Joining, or Shutdown
type PeerSelector ¶
type RandomPeerSelector ¶
type RandomPeerSelector struct {
// contains filtered or unexported fields
}
func NewRandomPeerSelector ¶
func NewRandomPeerSelector(peerSet *peers.PeerSet, selfID uint32) *RandomPeerSelector
func (*RandomPeerSelector) Next ¶
func (ps *RandomPeerSelector) Next() *peers.Peer
func (*RandomPeerSelector) Peers ¶
func (ps *RandomPeerSelector) Peers() *peers.PeerSet
func (*RandomPeerSelector) UpdateLast ¶
func (ps *RandomPeerSelector) UpdateLast(peer uint32)
Click to show internal directories.
Click to hide internal directories.