コード例 #1
0
        public RendezvousCluster(IConfigurationStorage<RendezvousClusterConfiguration> configurationStorage)
        {
            this.configurationStorage = configurationStorage;

            config = new HashedLinkedList<RendezvousEndpoint>();
            config.AddAll(configurationStorage.Read().Cluster);
        }
コード例 #2
0
        public RendezvousCluster(IConfigurationStorage <RendezvousClusterConfiguration> configurationStorage)
        {
            this.configurationStorage = configurationStorage;

            config = new HashedLinkedList <RendezvousEndpoint>();
            config.AddAll(configurationStorage.Read().Cluster);
        }
コード例 #3
0
        public void Update(RendezvousClusterConfiguration newConfig)
        {
            var tmp = new HashedLinkedList <RendezvousEndpoint>();

            tmp.AddAll(SelectEndpointsDistinct(newConfig.Cluster));

            config = tmp;
        }
コード例 #4
0
 public void Reconfigure(IEnumerable <RendezvousEndpoint> newConfiguration)
 {
     configurationStorage.Update(new RendezvousClusterConfiguration {
         Cluster = newConfiguration
     });
     lock (@lock)
     {
         config.Clear();
         config.AddAll(configurationStorage.Read().Cluster);
     }
 }
コード例 #5
0
        private static IEnumerable <RendezvousEndpoint> SelectEndpointsDistinct(IEnumerable <RendezvousEndpoint> initialConfiguration)
        {
            var tmp = new HashedLinkedList <RendezvousEndpoint>();

            tmp.AddAll(initialConfiguration);

            if (tmp.Count < initialConfiguration.Count())
            {
                throw new DuplicatedKeyException("Initial Rendezvous configuration contains duplicated endpoints!");
            }

            return(tmp);
        }
コード例 #6
0
        public RendezvousClusterConfigurationReadonlyStorage(IEnumerable <RendezvousEndpoint> initialConfiguration)
        {
            config = new HashedLinkedList <RendezvousEndpoint>();

            config.AddAll(SelectEndpointsDistinct(initialConfiguration));
        }