model

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Raw = iota
	Ack
	Wit
	Catchup
)
View Source
const ChanLen = 500

Variables

View Source
var Logger1 *log.Logger

Functions

This section is empty.

Types

type CommunicationInterface

type CommunicationInterface interface {
	Send(Message, int) // Send a message to a specific node
	Broadcast(Message) // Broadcast messages to other nodes
	Receive() *Message // Blocking receive
	Disconnect()       // Disconnect node
	Reconnect(string)  // Reconnect node
}

CommunicationInterface is a interface used for communicating with transport layer.

type Message

type Message struct {
	Source  int       // NodeID of message's source
	Step    int       // Time step of message
	MsgType MsgType   // Type of message
	History []Message // History of messages. Sent to ensure causality, But in an inefficient way.
}

type MsgType

type MsgType int

type Node

type Node struct {
	Id           int                    // Id of the node
	TimeStep     int                    // Node's local time step
	ThresholdAck int                    // Threshold on number of messages
	ThresholdWit int                    // Threshold on number of witnessed messages
	Acks         int                    // Number of acknowledges
	Wits         int                    // Number of witnesses
	Comm         CommunicationInterface // interface for communicating with other nodes
	CurrentMsg   Message                // Message which the node is waiting for acks
	History      []Message              // History of received messages by a node

}

Node is the struct used for keeping everything related to a node in TLC.

func (*Node) Advance

func (node *Node) Advance(step int)

Advance will change the step of the node to a new one and then broadcast a message to the network.

func (*Node) WaitForMsg

func (node *Node) WaitForMsg(stop int)

waitForMsg waits for upcoming messages and then decides the next action with respect to msg's contents.

Jump to

Keyboard shortcuts

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