topology

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConnectedness added in v0.12.0

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

CheckConnectedness verifies graph as a whole is connected.

func CheckConnectednessByChannelID added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

func MockSubscriptionManager(t *testing.T, ids flow.IdentityList) []channel.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 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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

NewTopicBasedTopology returns an instance of the TopicBasedTopology.

func (TopicBasedTopology) GenerateFanout added in v0.12.0

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.

type Topology

type Topology interface {
	// 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.
	GenerateFanout(ids flow.IdentityList) (flow.IdentityList, error)
}

Topology provides a subset of nodes which a given node should directly connect to for 1-k messaging

Jump to

Keyboard shortcuts

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