Beispiel #1
0
 /// <summary>
 /// Setup the RPC and register for incoming messages.
 /// </summary>
 /// <param name="peerBean">The peer bean.</param>
 /// <param name="connectionBean">The connection bean.</param>
 /// <param name="register">Whether incoming messages should be registered.</param>
 public NeighborRpc(PeerBean peerBean, ConnectionBean connectionBean, bool register)
     : base(peerBean, connectionBean)
 {
     if (register)
     {
         Register(Rpc.Commands.Neighbor.GetNr());
     }
 }
Beispiel #2
0
 /// <summary>
 /// Constructor that is only called from this class or from test cases.
 /// </summary>
 /// <param name="peerBean">The peer bean.</param>
 /// <param name="connectionBean">The connection bean.</param>
 /// <param name="enable">Used for test cases, set to true in production.</param>
 /// <param name="register">Used for test cases, set to true in production.</param>
 /// <param name="wait">Used for test cases, set to false in production.</param>
 public PingRpc(PeerBean peerBean, ConnectionBean connectionBean, bool enable, bool register, bool wait)
     : base(peerBean, connectionBean)
 {
     _enable = enable;
     _wait   = wait;
     if (register)
     {
         ConnectionBean.Dispatcher.RegisterIOHandler(peerBean.ServerPeerAddress.PeerId, peerBean.ServerPeerAddress.PeerId, this, Rpc.Commands.Ping.GetNr());
     }
 }
Beispiel #3
0
 /// <summary>
 /// Registers the storage RPC for PUT, COMPARE PUT, GET, ADD and REMOVE.
 /// </summary>
 /// <param name="peerBean"></param>
 /// <param name="connectionBean"></param>
 /// <param name="storageLayer"></param>
 public StorageRpc(PeerBean peerBean, ConnectionBean connectionBean, StorageLayer storageLayer)
     : base(peerBean, connectionBean)
 {
     Register(
         Rpc.Commands.Put.GetNr(),
         Rpc.Commands.Get.GetNr(),
         Rpc.Commands.Add.GetNr(),
         Rpc.Commands.Remove.GetNr(),
         Rpc.Commands.Digest.GetNr(),
         Rpc.Commands.DigestBloomfilter.GetNr(),
         Rpc.Commands.DigestAllBloomfilter.GetNr(),
         Rpc.Commands.PutMeta.GetNr(),
         Rpc.Commands.DigestMetaValues.GetNr(),
         Rpc.Commands.PutConfirm.GetNr(),
         Rpc.Commands.GetLatest.GetNr(),
         Rpc.Commands.GetLatestWithDigest.GetNr(),
         Rpc.Commands.ReplicaPut.GetNr());
     _bloomfilterFactory = peerBean.BloomfilterFactory;
     _storageLayer       = storageLayer;
 }
Beispiel #4
0
 /// <summary>
 /// Creates a handler with a peer bean and a connection bean.
 /// </summary>
 /// <param name="peerBean">The peer bean.</param>
 /// <param name="connectionBean">The connection bean.</param>
 protected DispatchHandler(PeerBean peerBean, ConnectionBean connectionBean)
 {
     PeerBean       = peerBean;
     ConnectionBean = connectionBean;
 }
Beispiel #5
0
 public NeighborRpc(PeerBean peerBean, ConnectionBean connectionBean)
     : this(peerBean, connectionBean, true)
 {
 }
Beispiel #6
0
 public BroadcastRpc(PeerBean peerBean, ConnectionBean connectionBean, IBroadcastHandler broadcastHandler)
     : base(peerBean, connectionBean)
 {
     Register(Rpc.Commands.Broadcast.GetNr());
     BroadcastHandler = broadcastHandler;
 }
Beispiel #7
0
 /// <summary>
 /// Creates a new handshake RPC with listeners.
 /// </summary>
 /// <param name="peerBean">The peer bean.</param>
 /// <param name="connectionBean">The connection bean.</param>
 public PingRpc(PeerBean peerBean, ConnectionBean connectionBean)
     : this(peerBean, connectionBean, true, true, false)
 {
 }
Beispiel #8
0
 public DirectDataRpc(PeerBean peerBean, ConnectionBean connectionBean)
     : base(peerBean, connectionBean)
 {
     Register(Rpc.Commands.DirectData.GetNr());
 }
Beispiel #9
0
 /// <summary>
 /// Constructor that registers this RPC with the message handler.
 /// </summary>
 /// <param name="peerBean">The peer bean.</param>
 /// <param name="connectionBean">The connection bean.</param>
 public QuitRpc(PeerBean peerBean, ConnectionBean connectionBean)
     : base(peerBean, connectionBean)
 {
     Register(Rpc.Commands.Quit.GetNr());
 }