Example #1
0
        public Node(NodeSettings nodeSettings)
        {
            if (nodeSettings == null)
            {
                throw new ArgumentNullException("nodeSettings");
            }

            settings = nodeSettings;
            requestHandler = new Follower(this);
            electionTimeout = nodeSettings.ElectionTimeout;
            Id = settings.NodeId;
            LocalLog = new Log();
            ServerLog = new Log();
            Term = 1;
   

            disposables.Add(nodeSettings.PeerObserver
                                        .Subscribe(Observer.Create<IEnumerable<Peer>>(peers =>
                                                                                      {
                                                                                          Peers = peers.Where(p => p.Id != Id);
                                                                                          //Peers.ForEach(p => Debug.WriteLine("{0} new peer discovered: {1}", NodeInfo(), p.Id));
                                                                                      },
                                                                                      ex => Debug.WriteLine("OnError: {0}", ex.Message),
                                                                                      () => Debug.WriteLine("OnCompleted"))));

        }
Example #2
0
 public TestNode(NodeSettings nodeSettings) : base(nodeSettings)
 {
 }
Example #3
0
 public TestNode(NodeSettings nodeSettings) : base(nodeSettings)
 {
 }