public static async Task UpdateBrokerHttpClientsDictionary(EtcdClient client, Dictionary <string, HttpClient> brokerHttpClientsDict, HttpClient[] brokerHttpClients)
        {
            var rangeVal = await client.GetRangeValAsync(TopicTablePrefix);

            foreach (var(key, value) in rangeVal)
            {
                AddToBrokerHttpClientsDictionary(brokerHttpClientsDict, brokerHttpClients, key, value);
            }
        }
        public static async Task <HttpClient[]> UpdateBrokers(EtcdClient client, HttpClient[] brokerHttpClients)
        {
            var rangeResponse = await client.GetRangeValAsync(BrokerTablePrefix);

            var maxBrokerNumber = rangeResponse.Keys.Max(GetBrokerNumber);

            brokerHttpClients = new HttpClient[maxBrokerNumber + 1];
            foreach (var(key, _) in rangeResponse)
            {
                AddBroker(key, brokerHttpClients);
            }
            return(brokerHttpClients);
        }
        public async Task <ReminderTableData> ReadRows(GrainReference key)
        {
            ReminderTableData data = new ReminderTableData();
            // E.g. Get all keys with pattern "key/*"
            var range = await etcdClient.GetRangeValAsync($"{key}/").ConfigureAwait(false);

            foreach (var item in range)
            {
                //data.Reminders.Add(new ReminderEntry()
                // {
                //       item.Value.ToByteArray()
                //    })
            }

            return(null);
        }
Exemplo n.º 4
0
        public static async Task <BrokerSocket[]> UpdateSpecificBrokerSockets(EtcdClient client, BrokerSocket[] brokerSockets, BrokerSocket brokerSocket)
        {
            var rangeResponse = await client.GetRangeValAsync(BrokerTablePrefix);

            if (rangeResponse.Count == 0)
            {
                Console.WriteLine("No brokers connected");
                return(new BrokerSocket[] { });
            }
            var maxBrokerNumber = rangeResponse.Keys.Max(GetBrokerNumber);

            brokerSockets = new BrokerSocket[maxBrokerNumber + 1];
            foreach (var(key, _) in rangeResponse)
            {
                await AddBroker(key, brokerSockets);
            }
            return(brokerSockets);
        }
        public async void CanDeserializeKvsFromRange()
        {
            JsonConvert.SerializeObject(new MorsteadEtcdBasedReminderEntry()
            {
                ETag = "ETag"
            });

            var client = new EtcdClient("http://localhost:2379");
            await client.PutAsync("key/1", JsonConvert.SerializeObject(new MorsteadEtcdBasedReminderEntry()
            {
                ETag = "ETag"
            }));

            var s = await client.GetRangeValAsync("key/*");

            foreach (var i in s)
            {
            }
        }