Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callback ¶
type Callback interface {
Stop()
}
Wrapers for callback that is called once after `wait` units of time. Callbacks can be stopped as well.
type ControlTransport ¶
type DataTransport ¶
type DataTransport interface { NodeCapacity Connect(string) Link }
type ISimulation ¶
type ISimulation interface { Run() Stop() Time() int }
A Simulation interface exposed when using the SDK.
type Link ¶
type Link interface { // Functions provided for Uploading and Downloading data from a link. Upload(Data) Download() <-chan Data // Function used to clear the data to be uploaded to the channel. Clear() // Upload and download capacities(together with an identifier) for each // end of the connection. From() NodeCapacity To() NodeCapacity }
type Node ¶
type Node interface { // constructor interface New(util NodeUtil) Node // Function that represents what the node should do when notified. OnNotify() // Function that represent the initial action taken by a node when it // joins the network. OnJoin() // A method that should be called when a node leaves the network. OnLeave() }
This interface needs to be implemented by a node. All the functions OnJoin, OnNotify and OnLeave should be non-blocking since the simulator uses coroutines.
type NodeCapacity ¶
type NodeUtil ¶
type NodeUtil interface { RoutineCapabilities Transport() Transport Id() string Join() string Time() func() int }
The Util interface is provided to a node.
type Routine ¶
Wrapers for routines that run at fixed intervals. The inital call of the routine is right after the routine is built. The next ones are done after the set interval. When the interval is changed via SetInterval the interval is changed only after the first call schduled by the old scheduling interval. Routines can be stopped.
type RoutineCapabilities ¶
type Transport ¶
type Transport interface { ControlTransport DataTransport }