Exemplo n.º 1
0
        // 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();
        }
Exemplo n.º 2
0
        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();
        }