public RendezvousCluster(IConfigurationStorage<RendezvousClusterConfiguration> configurationStorage) { this.configurationStorage = configurationStorage; config = new HashedLinkedList<RendezvousEndpoint>(); config.AddAll(configurationStorage.Read().Cluster); }
public RendezvousCluster(IConfigurationStorage <RendezvousClusterConfiguration> configurationStorage) { this.configurationStorage = configurationStorage; config = new HashedLinkedList <RendezvousEndpoint>(); config.AddAll(configurationStorage.Read().Cluster); }
public void Update(RendezvousClusterConfiguration newConfig) { var tmp = new HashedLinkedList <RendezvousEndpoint>(); tmp.AddAll(SelectEndpointsDistinct(newConfig.Cluster)); config = tmp; }
public void Reconfigure(IEnumerable <RendezvousEndpoint> newConfiguration) { configurationStorage.Update(new RendezvousClusterConfiguration { Cluster = newConfiguration }); lock (@lock) { config.Clear(); config.AddAll(configurationStorage.Read().Cluster); } }
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); }
public RendezvousClusterConfigurationReadonlyStorage(IEnumerable <RendezvousEndpoint> initialConfiguration) { config = new HashedLinkedList <RendezvousEndpoint>(); config.AddAll(SelectEndpointsDistinct(initialConfiguration)); }