예제 #1
0
파일: Startup.cs 프로젝트: malain/nraft
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            Config cfg = new Config(peerId)
                         .WithPeer(1, "http://localhost:9999/")
                         .WithPeer(2, "http://localhost:9998/")
                         .WithClusterName("TEST");

            for (int j = 0; j < 1; j++)
            {
                //   cfg.AddPeer(j + 1);
            }

            var node = new RaftNode <TestStateMachine>(cfg);

            node.UseMiddleware(app);

            node.Start();
        }
예제 #2
0
파일: Program.cs 프로젝트: malain/nraft
        public void TestCluster2()
        {
            CreateLogsDirectory();
            for (int i = 0; i < NUM_PEERS; i++)
            {
                Config cfg = new Config(i)
                             .WithClusterName("TEST");

                for (int j = 0; j < NUM_PEERS; j++)
                {
                    cfg.AddPeer(j);
                }
            }

            var node = new RaftNode <TestStateMachine>(cfg);

            node.UseMiddleware(app);

            node.Start();
        }