Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MultiElection ¶
type MultiElection struct {
// contains filtered or unexported fields
}
A MultiElection component is made out of multiple Election components. When an election takes place, the nodes that were elected get banned for the purpose of them not getting reelected. The banning process is done by eliminating all the banned candidates from all the elections that did not take place yet. For this algorithm to be correct, we require the number of sub-Torrents to be smaller than 100/leaderPercent.
func NewMultiElection ¶
func NewMultiElection(elections int, limit int, transport Transport) *MultiElection
func (*MultiElection) NewJoin ¶
func (e *MultiElection) NewJoin(id string)
func (*MultiElection) Recv ¶
func (e *MultiElection) Recv(m interface{})
func (*MultiElection) RegisterCandidate ¶
func (e *MultiElection) RegisterCandidate(candidate cache_torrent.Candidate)
func (*MultiElection) Run ¶
func (e *MultiElection) Run()
type MultiPeer ¶
type MultiPeer struct { *cache_torrent.Peer // contains filtered or unexported fields }
A MultiPeer is wrapper over multiple Peers which follow the CacheTorrent protocol. The Original message IDs are decorated with an internal ID, each MultiPeer having an ID format "<multipeer-id>.<peer-id>". Once a message arrives to a Peer, the id is stripped to "<multipeer-id>".
type MultiTracker ¶
The MultiTracker is a usual CacheTorrent Tracker which uses a StripProxy for sending messages towards the correct Peer and runs a MultiElection instead of a usual Election.
func (*MultiTracker) Neighbours ¶
func (t *MultiTracker) Neighbours(id string) interface{}
func (*MultiTracker) New ¶
func (t *MultiTracker) New(util TorrentNodeUtil) TorrentNode
func (*MultiTracker) OnJoin ¶
func (t *MultiTracker) OnJoin()
func (*MultiTracker) Recv ¶
func (t *MultiTracker) Recv(m interface{})
type PeerProxy ¶
type PeerProxy struct { *cache_torrent.Peer // contains filtered or unexported fields }
A PeerProxy is a Peer wrapper over Peer which is used to expose a more useful interface towards MultiPeer. The structure has no specific features besides providing more methods. The PeerProxy uses a TransportProxy to relay messages.
func NewPeerProxy ¶
type StripProxy ¶
type StripProxy struct {
Transport
}
func NewStripProxy ¶
func NewStripProxy(t Transport) *StripProxy
Each Peer is assigned an internal ID following the format "<multipeer-id>:<peer-id>". When a message departs a peer towards a peer <A>:<B>, the message will be sent towards the multi-peer <A>, which will deliver the message to its internal peer <B>. To implement this mechanism for sending messages, we implement a StripProxy which strips the peer internal ID when a message is sent.
func (*StripProxy) Connect ¶
func (t *StripProxy) Connect(id string) Link
func (*StripProxy) ControlPing ¶
func (t *StripProxy) ControlPing(id string) bool
func (*StripProxy) ControlSend ¶
func (t *StripProxy) ControlSend(id string, m interface{})