Documentation ¶
Index ¶
- func ASCIIschemeForEach(scheme string, callback ForEachEvent) (nodes []idx.ValidatorID, events map[idx.ValidatorID]dag.Events, ...)
- func ASCIIschemeToDAG(scheme string) (nodes []idx.ValidatorID, events map[idx.ValidatorID]dag.Events, ...)
- func ByParents(ee dag.Events) (res dag.Events)
- func DAGtoASCIIscheme(events dag.Events) (string, error)
- func ForEachRandEvent(nodes []idx.ValidatorID, eventCount int, parentCount int, r *rand.Rand, ...) (events map[idx.ValidatorID]dag.Events)
- func ForEachRandFork(nodes []idx.ValidatorID, cheatersArr []idx.ValidatorID, eventCount int, ...) (events map[idx.ValidatorID]dag.Events)
- func GenNodes(nodeCount int) (nodes []idx.ValidatorID)
- func GenRandEvents(nodes []idx.ValidatorID, eventCount int, parentCount int, r *rand.Rand) (events map[idx.ValidatorID]dag.Events)
- type ForEachEvent
- type TestEvent
- type TestEventMarshaling
- type TestEvents
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ASCIIschemeForEach ¶
func ASCIIschemeForEach( scheme string, callback ForEachEvent, ) ( nodes []idx.ValidatorID, events map[idx.ValidatorID]dag.Events, names map[string]dag.Event, )
ASCIIschemeToDAG parses events from ASCII-scheme for test purpose. Use joiners ║ ╬ ╠ ╣ ╫ ╚ ╝ ╩ and optional fillers ─ ═ to draw ASCII-scheme. Result:
- nodes is an array of node addresses;
- events maps node address to array of its events;
- names maps human readable name to the event;
func ASCIIschemeToDAG ¶
func ASCIIschemeToDAG( scheme string, ) ( nodes []idx.ValidatorID, events map[idx.ValidatorID]dag.Events, names map[string]dag.Event, )
func ByParents ¶
ByParents returns events topologically ordered by parent dependency. Used only for tests.
func DAGtoASCIIscheme ¶
DAGtoASCIIscheme builds ASCII-scheme of events for debug purpose.
func ForEachRandEvent ¶
func ForEachRandEvent( nodes []idx.ValidatorID, eventCount int, parentCount int, r *rand.Rand, callback ForEachEvent, ) ( events map[idx.ValidatorID]dag.Events, )
ForEachRandEvent generates random events for test purpose. Result:
- callbacks are called for each new event;
- events maps node address to array of its events;
func ForEachRandFork ¶
func ForEachRandFork( nodes []idx.ValidatorID, cheatersArr []idx.ValidatorID, eventCount int, parentCount int, forksCount int, r *rand.Rand, callback ForEachEvent, ) ( events map[idx.ValidatorID]dag.Events, )
ForEachRandFork generates random events with forks for test purpose. Result:
- callbacks are called for each new event;
- events maps node address to array of its events;
func GenNodes ¶
func GenNodes( nodeCount int, ) ( nodes []idx.ValidatorID, )
GenNodes generates nodes. Result:
- nodes is an array of node addresses;
func GenRandEvents ¶
func GenRandEvents( nodes []idx.ValidatorID, eventCount int, parentCount int, r *rand.Rand, ) ( events map[idx.ValidatorID]dag.Events, )
GenRandEvents generates random events for test purpose. Result:
- events maps node address to array of its events;
Types ¶
type ForEachEvent ¶
type TestEvent ¶
type TestEvent struct { dag.MutableBaseEvent Name string }
type TestEventMarshaling ¶
type TestEvents ¶
type TestEvents []*TestEvent
Events is a ordered slice of events.
func (TestEvents) ByParents ¶
func (ee TestEvents) ByParents() (res TestEvents)
ByParents returns events topologically ordered by parent dependency. Used only for tests.
func (TestEvents) String ¶
func (ee TestEvents) String() string
String returns human readable representation.