Esempio n. 1
0
 public async Task <PutResponse> Put(string key, string value, long leaseId = 0)
 {
     return(await kvClient.PutAsync(new PutRequest()
     {
         Key = ByteString.CopyFromUtf8(key), Value = ByteString.CopyFromUtf8(value), Lease = leaseId
     }));
 }
Esempio n. 2
0
 /// <summary>
 /// Sets the key value in etcd in async
 /// </summary>
 /// <param name="key">Key for which value need to be set</param>
 /// <param name="val">Value corresponding the key</param>
 /// <returns></returns>
 public async void PutAsync(string key, string val)
 {
     await _kvClient.PutAsync(new PutRequest
     {
         Key   = ByteString.CopyFromUtf8(key),
         Value = ByteString.CopyFromUtf8(val)
     }, _headers);
 }
Esempio n. 3
0
 /// <summary>
 /// Sets the key value in etcd in async
 /// </summary>
 /// <param name="key">Key for which value need to be set</param>
 /// <param name="val">Value corresponding the key</param>
 /// <returns></returns>
 public async Task <PutResponse> PutAsync(string key, string val)
 {
     try
     {
         return(await _kvClient.PutAsync(new PutRequest
         {
             Key = ByteString.CopyFromUtf8(key),
             Value = ByteString.CopyFromUtf8(val)
         }, _headers));
     }
     catch (Grpc.Core.RpcException)
     {
         ResetConnection();
         throw;
     }
     catch
     {
         throw;
     }
 }