topology

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: AGPL-3.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConnectedness

func CheckConnectedness(t *testing.T, adjMap map[flow.Identifier]flow.IdentityList, ids flow.IdentityList)

CheckConnectedness verifies graph as a whole is connected.

func CheckConnectednessByChannelID

func CheckConnectednessByChannelID(t *testing.T, adjMap map[flow.Identifier]flow.IdentityList, ids flow.IdentityList,
	channelID string)

CheckConnectednessByChannelID verifies that the subgraph of nodes subscribed to a channelID is connected.

func CheckGraphConnected

func CheckGraphConnected(t *testing.T, adjMap map[flow.Identifier]flow.IdentityList, ids flow.IdentityList, f flow.IdentityFilter)

CheckGraphConnected checks if the graph represented by the adjacency matrix is connected. It traverses the adjacency map starting from an arbitrary node and checks if all nodes that satisfy the filter were visited.

func CheckMembership

func CheckMembership(t *testing.T, top flow.IdentityList, all flow.IdentityList)

CheckMembership checks each identity in a top list belongs to all identity list.

func CheckTopologySize

func CheckTopologySize(t *testing.T, total int, top flow.IdentityList)

TODO: fix this test after we have fanout optimized. CheckTopologySize evaluates that overall topology size of a node is bound by the fanout of system.

func ClusterNum

func ClusterNum(t *testing.T, ids flow.IdentityList, size int) int

ClusterNum is a test helper determines the number of clusters of specific `size`.

func CreateMockStateForCollectionNodes

func CreateMockStateForCollectionNodes(t *testing.T, collectorIds flow.IdentityList,
	clusterNum uint) (protocol.State, flow.ClusterList)

CreateMockStateForCollectionNodes is a test helper function that generate a mock state clustering collection nodes into `clusterNum` clusters.

func LinearFanout

func LinearFanout(size int) int

LinearFanoutFunc guarantees full network connectivity in a deterministic way. Given system of `size` nodes, it returns `size+1/2`.

func MockSubscriptionManager

func MockSubscriptionManager(t *testing.T, ids flow.IdentityList) []network.SubscriptionManager

MockSubscriptionManager returns a list of mocked subscription manages for the input identities. It only mocks the GetChannelIDs method of the subscription manager. Other methods return an error, as they are not supposed to be invoked.

Types

type FanoutFunc

type FanoutFunc func(size int) int

FanoutFunc represents a function type that receiving total number of nodes in flow system, returns fanout of individual nodes.

type TopicBasedTopology

type TopicBasedTopology struct {
	// contains filtered or unexported fields
}

TopicBasedTopology is a deterministic topology mapping that creates a connected graph component among the nodes involved in each topic.

func NewTopicBasedTopology

func NewTopicBasedTopology(nodeID flow.Identifier,
	logger zerolog.Logger,
	state protocol.ReadOnlyState,
	subMngr network.SubscriptionManager) (*TopicBasedTopology, error)

NewTopicBasedTopology returns an instance of the TopicBasedTopology.

func (TopicBasedTopology) GenerateFanout

func (t TopicBasedTopology) GenerateFanout(ids flow.IdentityList) (flow.IdentityList, error)

GenerateFanout receives IdentityList of entire network and constructs the fanout IdentityList of this instance. A node directly communicates with its fanout IdentityList on epidemic dissemination of the messages (i.e., publish and multicast). Independent invocations of GenerateFanout on different nodes collaboratively must construct a cohesive connected graph of nodes that enables them talking to each other.

Jump to

Keyboard shortcuts

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