public void Start()
        {
            hashTable.Initialize();
            hashTable.Batch(actions =>
            {
                var value = actions.Get(new GetRequest {
                    Key = Constants.Topology
                }).LastOrDefault();

                if (value != null)
                {
                    var topology = MessageStreamIterator <TopologyResultMessage>
                                   .FromStreamProvider(() => new MemoryStream(value.Data))
                                   .First();

                    master.Topology = topology.GetTopology();
                    master.RefreshEndpoints();
                }
                actions.Commit();
            });

            listener.Start();
            listener.BeginAcceptTcpClient(OnAcceptTcpClient, null);
            OnTopologyChanged();
        }
예제 #2
0
            public void DirectlyModifyingTopologyAndThenCallingRefreshEndpointsShouldShowAllEndpoints()
            {
                Assert.False(master.Endpoints.Any(x => x == NodeEndpoint.ForTest(1)));

                master.Topology.Segments[0].AssignedEndpoint = NodeEndpoint.ForTest(1);
                master.RefreshEndpoints();

                Assert.True(master.Endpoints.Any(x => x == NodeEndpoint.ForTest(1)));
            }