Documentation ¶
Index ¶
- Constants
- func GenerateIDs(t *testing.T, n int, dryRunMode bool, opts ...func(*flow.Identity)) (flow.IdentityList, []crypto.PrivateKey)
- func GenerateIDsAndMiddlewares(t *testing.T, n int, dryRunMode bool, log zerolog.Logger) (flow.IdentityList, []*libp2p.Middleware)
- func GenerateIDsMiddlewaresNetworks(t *testing.T, n int, log zerolog.Logger, csize int, tops []topology.Topology, ...) (flow.IdentityList, []*libp2p.Middleware, []*libp2p.Network)
- func GenerateMiddlewares(t *testing.T, log zerolog.Logger, identities flow.IdentityList, ...) []*libp2p.Middleware
- func GenerateNetworkingKey(s flow.Identifier) (crypto.PrivateKey, error)
- func GenerateNetworks(t *testing.T, log zerolog.Logger, ids flow.IdentityList, ...) []*libp2p.Network
- func GenerateSubscriptionManagers(t *testing.T, mws []*libp2p.Middleware) []channel.SubscriptionManager
- func GenerateTopologies(t *testing.T, state protocol.State, identities flow.IdentityList, ...) []topology.Topology
- type ConduitSendWrapperFunc
- type ConduitWrapper
- func (c *ConduitWrapper) Multicast(msg interface{}, conduit network.Conduit, targetIDs ...flow.Identifier) error
- func (c *ConduitWrapper) Publish(msg interface{}, conduit network.Conduit, targetIDs ...flow.Identifier) error
- func (c *ConduitWrapper) Submit(msg interface{}, conduit network.Conduit, targetIDs ...flow.Identifier) error
- func (c *ConduitWrapper) Unicast(msg interface{}, conduit network.Conduit, targetIDs ...flow.Identifier) error
- type EchoEngine
- type MeshEngine
Constants ¶
const DryRun = true
Variables ¶
This section is empty.
Functions ¶
func GenerateIDs ¶ added in v0.12.0
func GenerateIDs(t *testing.T, n int, dryRunMode bool, opts ...func(*flow.Identity)) (flow.IdentityList, []crypto.PrivateKey)
GenerateIDs generate flow Identities with a valid port and networking key
func GenerateIDsAndMiddlewares ¶ added in v0.12.0
func GenerateIDsAndMiddlewares(t *testing.T, n int, dryRunMode bool, log zerolog.Logger) (flow.IdentityList, []*libp2p.Middleware)
func GenerateIDsMiddlewaresNetworks ¶ added in v0.12.0
func GenerateMiddlewares ¶ added in v0.12.0
func GenerateMiddlewares(t *testing.T, log zerolog.Logger, identities flow.IdentityList, keys []crypto.PrivateKey) []*libp2p.Middleware
GenerateMiddlewares creates and initializes middleware instances for all the identities
func GenerateNetworkingKey ¶
func GenerateNetworkingKey(s flow.Identifier) (crypto.PrivateKey, error)
GenerateNetworkingKey generates a Flow ECDSA key using the given seed
func GenerateNetworks ¶ added in v0.12.0
func GenerateNetworks(t *testing.T, log zerolog.Logger, ids flow.IdentityList, mws []*libp2p.Middleware, csize int, tops []topology.Topology, sms []channel.SubscriptionManager, dryRunMode bool) []*libp2p.Network
GenerateNetworks generates the network for the given middlewares
func GenerateSubscriptionManagers ¶ added in v0.12.0
func GenerateSubscriptionManagers(t *testing.T, mws []*libp2p.Middleware) []channel.SubscriptionManager
GenerateSubscriptionManagers creates and returns a ChannelSubscriptionManager for each middleware object.
func GenerateTopologies ¶ added in v0.12.0
func GenerateTopologies(t *testing.T, state protocol.State, identities flow.IdentityList, subMngrs []channel.SubscriptionManager, logger zerolog.Logger) []topology.Topology
CreateTopologies is a test helper on receiving an identity list, creates a topology per identity and returns the slice of topologies.
Types ¶
type ConduitSendWrapperFunc ¶
type ConduitSendWrapperFunc func(msg interface{}, conduit network.Conduit, targetIDs ...flow.Identifier) error
ConduitSendWrapperFunc is a wrapper around the set of methods offered by the Conduit (e.g., Publish). This data type is solely introduced at the test level. Its primary purpose is to make the same test reusable on different Conduit methods.
type ConduitWrapper ¶
type ConduitWrapper struct{}
func (*ConduitWrapper) Multicast ¶
func (c *ConduitWrapper) Multicast(msg interface{}, conduit network.Conduit, targetIDs ...flow.Identifier) error
Multicast defines a function that receives a message, conduit of an engine instance, and a set of target ID. It then sends the message to the target IDs using the Multicast method of conduit.
func (*ConduitWrapper) Publish ¶
func (c *ConduitWrapper) Publish(msg interface{}, conduit network.Conduit, targetIDs ...flow.Identifier) error
Publish defines a function that receives a message, conduit of an engine instance, and a set target IDs. It then sends the message to the target IDs using the Publish method of conduit.
func (*ConduitWrapper) Submit ¶
func (c *ConduitWrapper) Submit(msg interface{}, conduit network.Conduit, targetIDs ...flow.Identifier) error
Submit defines a function that receives a message, conduit of an engine instance, and a set of target IDa. It then sends the message to the target IDs using the Submit method of conduit.
func (*ConduitWrapper) Unicast ¶
func (c *ConduitWrapper) Unicast(msg interface{}, conduit network.Conduit, targetIDs ...flow.Identifier) error
Unicast defines a function that receives a message, conduit of an engine instance, and a set of target IDs. It then sends the message to the target IDs using individual Unicasts to each target in the underlying network.
type EchoEngine ¶
EchoEngine is a simple engine that is used for testing the correctness of driving the engines with libp2p, in addition to receiving and storing incoming messages it also echos them back
func NewEchoEngine ¶
func NewEchoEngine(t *testing.T, net module.Network, cap int, engineID string, echo bool, send ConduitSendWrapperFunc) *EchoEngine
func (*EchoEngine) Process ¶
func (te *EchoEngine) Process(originID flow.Identifier, event interface{}) error
Process receives an originID and an event and casts them into the corresponding fields of the EchoEngine. It then flags the received channel on reception of an event. It also sends back an echo of the message to the origin ID
func (*EchoEngine) ProcessLocal ¶
func (te *EchoEngine) ProcessLocal(event interface{}) error
ProcessLocal is implemented for a valid type assertion to Engine any call to it fails the test
func (*EchoEngine) Submit ¶
func (te *EchoEngine) Submit(originID flow.Identifier, event interface{})
Submit is implemented for a valid type assertion to Engine any call to it fails the test
func (*EchoEngine) SubmitLocal ¶
func (te *EchoEngine) SubmitLocal(event interface{})
SubmitLocal is implemented for a valid type assertion to Engine any call to it fails the test
type MeshEngine ¶
type MeshEngine struct {
// contains filtered or unexported fields
}
MeshEngine is a simple engine that is used for testing the correctness of driving the engines with libp2p, it simply receives and stores the incoming messages
func GenerateEngines ¶ added in v0.12.0
func GenerateEngines(t *testing.T, nets []*libp2p.Network) []*MeshEngine
GenerateEngines generates MeshEngines for the given networks
func NewMeshEngine ¶
func (*MeshEngine) Process ¶
func (e *MeshEngine) Process(originID flow.Identifier, event interface{}) error
Process receives an originID and an event and casts them into the corresponding fields of the MeshEngine. It then flags the received channel on reception of an event.
func (*MeshEngine) ProcessLocal ¶
func (e *MeshEngine) ProcessLocal(event interface{}) error
ProcessLocal is implemented for a valid type assertion to Engine any call to it fails the test
func (*MeshEngine) Submit ¶
func (e *MeshEngine) Submit(originID flow.Identifier, event interface{})
Submit is implemented for a valid type assertion to Engine any call to it fails the test
func (*MeshEngine) SubmitLocal ¶
func (e *MeshEngine) SubmitLocal(event interface{})
SubmitLocal is implemented for a valid type assertion to Engine any call to it fails the test