C# Class TransportService.PeerQueue

Class representing the queue of peer recognized as senders of a particular resource. It works to allow to balance load over peer while chosing every time the best peer to request to. This class is strictly connected to its foundamentals elements represented by theclass PeerQueueElement.
Exibir arquivo Open project: zencoders/sambatyon Class Usage Examples

Public Methods

Method Description
GetBestPeer ( ) : string

Method used to get the best sender peer at the moment of the call. The best peer of the queue is the FREE peer that has the lesser score. This method is blocking until there are no FREE peer into the network.

PeerQueue ( ) : System

Default constructor of the class.

PeerQueue ( float>.Dictionary peerQueue ) : System

Constructor of the class used to actively insert a certain number of peer inside the queue.

ResetPeer ( string key, int newScore ) : void

Method used to reset the state of a single peer into the queue. It sets the new score (as passed) of the peer indicated.

this ( string key ) : PeerQueueElement

Operator overload of the operator square brackets. It directly refers to the inner dictionary.

Method Details

GetBestPeer() public method

Method used to get the best sender peer at the moment of the call. The best peer of the queue is the FREE peer that has the lesser score. This method is blocking until there are no FREE peer into the network.
public GetBestPeer ( ) : string
return string

PeerQueue() public method

Default constructor of the class.
public PeerQueue ( ) : System
return System

PeerQueue() public method

Constructor of the class used to actively insert a certain number of peer inside the queue.
public PeerQueue ( float>.Dictionary peerQueue ) : System
peerQueue float>.Dictionary /// A dictionay representing a bunch of peer each associated with a score of the peer. The less is /// the score, the better is the peer. ///
return System

ResetPeer() public method

Method used to reset the state of a single peer into the queue. It sets the new score (as passed) of the peer indicated.
public ResetPeer ( string key, int newScore ) : void
key string The URI representing the peer.
newScore int The new score of the peer.
return void

this() public method

Operator overload of the operator square brackets. It directly refers to the inner dictionary.
public this ( string key ) : PeerQueueElement
key string The URI of the peer to select
return PeerQueueElement