public ZooKeeperBasedMembershipTable(ILogger <ZooKeeperBasedMembershipTable> logger, IOptions <ZooKeeperMembershipOptions> membershipTableOptions, GlobalConfiguration globalConfiguration) { this.logger = logger; var options = membershipTableOptions.Value; watcher = new ZooKeeperWatcher(logger); InitConfig(options.ConnectionString, globalConfiguration.ClusterId); }
public ZooKeeperBasedMembershipTable(ILogger <ZooKeeperBasedMembershipTable> logger, IOptions <ZooKeeperClusteringSiloOptions> membershipTableOptions, IOptions <SiloOptions> siloOptions) { this.logger = logger; var options = membershipTableOptions.Value; watcher = new ZooKeeperWatcher(logger); InitConfig(options.ConnectionString, siloOptions.Value.ClusterId); }
public ZooKeeperGatewayListProvider(ILogger <ZooKeeperGatewayListProvider> logger, ClientConfiguration clientConfiguration, IOptions <ZooKeeperGatewayListProviderOptions> options) { watcher = new ZooKeeperWatcher(logger); deploymentPath = "/" + clientConfiguration.ClusterId; deploymentConnectionString = options.Value.ConnectionString + deploymentPath; maxStaleness = clientConfiguration.GatewayListRefreshPeriod; }
public ZooKeeperGatewayListProvider( ILogger <ZooKeeperGatewayListProvider> logger, IOptions <ZooKeeperGatewayListProviderOptions> options, IOptions <GatewayOptions> gatewayOptions, IOptions <ClusterOptions> clusterOptions) { _watcher = new ZooKeeperWatcher(logger); _deploymentPath = "/" + clusterOptions.Value.ClusterId; _deploymentConnectionString = options.Value.ConnectionString + _deploymentPath; _maxStaleness = gatewayOptions.Value.GatewayListRefreshPeriod; }
public ZooKeeperBasedMembershipTable( ILogger <ZooKeeperBasedMembershipTable> logger, IOptions <ZooKeeperClusteringSiloOptions> membershipTableOptions, IOptions <ClusterOptions> clusterOptions) { this.logger = logger; var options = membershipTableOptions.Value; watcher = new ZooKeeperWatcher(logger); this.clusterPath = "/" + clusterOptions.Value.ClusterId; rootConnectionString = options.ConnectionString; deploymentConnectionString = options.ConnectionString + this.clusterPath; }
private static Task <T> UsingZookeeper <T>(Func <ZooKeeper, Task <T> > zkMethod, string deploymentConnectionString, ZooKeeperWatcher watcher, bool canBeReadOnly = false) { return(ZooKeeper.Using(deploymentConnectionString, ZOOKEEPER_CONNECTION_TIMEOUT, watcher, zkMethod, canBeReadOnly)); }
internal static Task <MembershipTableData> ReadAll(string deploymentConnectionString, ZooKeeperWatcher watcher) { return(UsingZookeeper(async zk => { var childrenResult = await zk.getChildrenAsync("/"); //get all the child nodes (without the data) var childrenTasks = //get the data from each child node childrenResult.Children.Select(child => GetRow(zk, SiloAddress.FromParsableString(child))).ToList(); var childrenTaskResults = await Task.WhenAll(childrenTasks); var tableVersion = ConvertToTableVersion(childrenResult.Stat);//this is the current table version return new MembershipTableData(childrenTaskResults.ToList(), tableVersion); }, deploymentConnectionString, watcher, true)); }
public ZooKeeperGatewayListProvider(ILogger <ZooKeeperGatewayListProvider> logger) { watcher = new ZooKeeperWatcher(logger); }