Package convex.cli.peer
Class PeerManager
java.lang.Object
convex.cli.peer.PeerManager
- All Implemented Interfaces:
IServerEvent
Convex CLI PeerManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Address
protected AKeyPair
protected BlockingQueue<ServerEvent>
protected Session
protected String
protected AStore
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add all peers started in this session to the session list.protected void
addToSession(Server peerServer)
Add a peer to the session list of peers.aquireBelief(String remotePeerHostname, Hash beliefHash)
aquireState(String remotePeerHostname, Hash stateHash)
static PeerManager
static PeerManager
getNetworkHashList(String remotePeerHostname)
protected int
getServerIndex(AccountKey peerKey)
void
launchLocalPeers(List<AKeyPair> keyPairList, int[] peerPorts)
void
launchPeer(String hostname, int port, String remotePeerHostname)
protected void
Load in a session from a session file.void
onServerChange(ServerEvent serverEvent)
Implements for IServerEventprotected void
Remove all peers added by this manager from the session list of peers.void
Once the manager has launched 1 or more peers.protected void
Store the session details to file.protected String
toServerInformationText(ServerInformation serverInformation)
-
Field Details
-
peerServerList
-
session
-
sessionFilename
-
keyPair
-
address
-
store
-
serverEventQueue
-
-
Method Details
-
create
-
create
public static PeerManager create(String sessionFilename, AKeyPair keyPair, Address address, AStore store) -
launchLocalPeers
-
getNetworkHashList
-
aquireState
-
aquireBelief
-
launchPeer
-
loadSession
protected void loadSession()Load in a session from a session file.- Parameters:
sessionFilename
- Filename to load.
-
addToSession
Add a peer to the session list of peers.- Parameters:
peerServer
- Add the peerServer to the list of peers for this session.
-
addAllToSession
protected void addAllToSession()Add all peers started in this session to the session list. -
removeAllFromSession
protected void removeAllFromSession()Remove all peers added by this manager from the session list of peers. -
storeSession
protected void storeSession()Store the session details to file.- Parameters:
sessionFilename
- Fileneame to save the session.
-
showPeerEvents
public void showPeerEvents()Once the manager has launched 1 or more peers. The manager now needs too loop and show any events generated by the peers -
toServerInformationText
-
getServerIndex
-
onServerChange
Implements for IServerEvent- Specified by:
onServerChange
in interfaceIServerEvent
-