Class PeerManager

java.lang.Object
convex.cli.peer.PeerManager
All Implemented Interfaces:
IServerEvent

public class PeerManager extends Object implements IServerEvent
Convex CLI PeerManager
  • Field Details

  • Method Details

    • create

      public static PeerManager create(String sessionFilename)
    • create

      public static PeerManager create(String sessionFilename, AKeyPair keyPair, Address address, AStore store)
    • launchLocalPeers

      public void launchLocalPeers(List<AKeyPair> keyPairList, int[] peerPorts)
    • getNetworkHashList

      public List<Hash> getNetworkHashList(String remotePeerHostname)
    • aquireState

      public State aquireState(String remotePeerHostname, Hash stateHash)
    • aquireBelief

      public SignedData<Belief> aquireBelief(String remotePeerHostname, Hash beliefHash)
    • launchPeer

      public void launchPeer(int port, String remotePeerHostname, String url, String bindAddress)
    • loadSession

      protected void loadSession()
      Load in a session from a session file.
      Parameters:
      sessionFilename - Filename to load.
    • addToSession

      protected void addToSession(Server peerServer)
      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

      protected String toServerInformationText(ServerInformation serverInformation)
    • getServerIndex

      protected int getServerIndex(AccountKey peerKey)
    • onServerChange

      public void onServerChange(ServerEvent serverEvent)
      Implements for IServerEvent
      Specified by:
      onServerChange in interface IServerEvent