-
Notifications
You must be signed in to change notification settings - Fork 2
/
peerRepository.ts
58 lines (49 loc) · 1.08 KB
/
peerRepository.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import {Peer} from "./peer";
/**
* Repository of active peers associated with a gossip tree.
*/
export interface PeerRepository {
addEager(peer: Peer): void
/**
* Provides the list of all the peers connected.
*
* @return the list of peers
*/
peers(): Peer[]
/**
* Provides the list of all lazy peers connected.
*
* @return the list of peers to push to lazily
*/
lazyPushPeers(): Peer[]
/**
* Provides the list of all eager peers connected.
*
* @return the list of peers to push to eagerly
*/
eagerPushPeers(): Peer[]
/**
* Removes a peer from the repository
*
* @param peer the peer to remove
*/
removePeer(peer: Peer): void
/**
* Moves a peer to the list of lazy peers
*
* @param peer the peer to move
*/
moveToLazy(peer: Peer): void
/**
* Moves a peer to the list of eager peers.
*
* @param peer the peer to move
*/
moveToEager(peer: Peer): void
/**
* Proposes a peer as a new peer.
*
* @param peer a peer to be considered for addition
*/
considerNewPeer(peer: Peer): void
}