MessageReceiver

This class handles the receiving of messages for a node in a distributed system. It implements the NodeCommands interface to define the commands that a node can execute.

Constructors

Link copied to clipboard
constructor(node: Node?)

Functions

Link copied to clipboard
open override fun candidature(leaderId: Long, minDepth: Int, maxDepth: Int, senderAddress: Address)

Sends a candidature for the election.

Link copied to clipboard
open override fun changeNNext(addr: Address?)

Changes the next neighbour of a node.

Link copied to clipboard
open override fun changePrev(addr: Address?): Address

Changes the previous neighbour of a node.

Link copied to clipboard
open override fun elected(winner: Long, winnerAddress: Address, senderAddress: Address)

Notifies that a node has been elected.

Link copied to clipboard
open override fun election(id: Long)

Starts an election in the distributed system.

Link copied to clipboard
open override fun hello()

Prints hello was called to the console after being called.

Link copied to clipboard
open override fun join(addr: Address?): DSNeighbours?

Joins a node to the distributed system.

Link copied to clipboard
open override fun nodeMissing(addr: Address?)

Notifies that a node is missing in the distributed system.

Link copied to clipboard
open override fun register(nickName: String?, addr: Address?)

Registers a node in the distributed system.

Link copied to clipboard
open override fun response(isPositiveResponse: Boolean, id: Long, senderAddress: Address)

Sends a response to a candidature.

Link copied to clipboard
open override fun sendMessage(toNickName: String?, fromNickName: String?, message: String?)

Sends a message to a node.