Exemplo n.º 1
0
        public RendezvousCluster(IConfigurationStorage<RendezvousClusterConfiguration> configurationStorage)
        {
            this.configurationStorage = configurationStorage;

            config = new HashedLinkedList<RendezvousEndpoint>();
            config.AddAll(configurationStorage.Read().Cluster);
        }
Exemplo n.º 2
0
        public RendezvousCluster(IConfigurationStorage <RendezvousClusterConfiguration> configurationStorage)
        {
            this.configurationStorage = configurationStorage;

            config = new HashedLinkedList <RendezvousEndpoint>();
            config.AddAll(configurationStorage.Read().Cluster);
        }
Exemplo n.º 3
0
        public void Update(RendezvousClusterConfiguration newConfig)
        {
            var tmp = new HashedLinkedList <RendezvousEndpoint>();

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

            config = tmp;
        }
Exemplo n.º 4
0
 public void Reconfigure(IEnumerable <RendezvousEndpoint> newConfiguration)
 {
     configurationStorage.Update(new RendezvousClusterConfiguration {
         Cluster = newConfiguration
     });
     lock (@lock)
     {
         config.Clear();
         config.AddAll(configurationStorage.Read().Cluster);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
        public RendezvousClusterConfigurationReadonlyStorage(IEnumerable <RendezvousEndpoint> initialConfiguration)
        {
            config = new HashedLinkedList <RendezvousEndpoint>();

            config.AddAll(SelectEndpointsDistinct(initialConfiguration));
        }