Ejemplo n.º 1
0
        /// <summary>
        /// DeleteTree is used to delete all keys under a prefix
        /// </summary>
        /// <param name="prefix">The key prefix to delete from</param>
        /// <param name="q">Customized write options</param>
        /// <returns>A write result indicating if the recursiv edelete attempt succeeded</returns>
        public Task <WriteResult <bool> > DeleteTree(string prefix, WriteOptions q, CancellationToken ct = default(CancellationToken))
        {
            KVPair.ValidatePath(prefix);
            var req = _client.DeleteReturning <bool>(string.Format("/v1/kv/{0}", prefix.TrimStart('/')), q);

            req.Params.Add("recurse", string.Empty);
            return(req.Execute(ct));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// DeleteTree is used to delete all keys under a prefix
        /// </summary>
        /// <param name="prefix">The key prefix to delete from</param>
        /// <param name="q">Customized write options</param>
        /// <returns>A write result indicating if the recursiv edelete attempt succeeded</returns>
        public Task <WriteResult <bool> > DeleteTree(string prefix, WriteOptions q)
        {
            KVPair.ValidatePath(prefix);
            var req = _client.Delete <bool>(string.Format("/v1/kv/{0}", prefix), q);

            req.Params.Add("recurse", string.Empty);
            return(req.Execute());
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Delete is used to delete a single key.
 /// </summary>
 /// <param name="key">The key name to delete</param>
 /// <param name="q">Customized write options</param>
 /// <returns>A write result indicating if the delete attempt succeeded</returns>
 public Task <WriteResult <bool> > Delete(string key, WriteOptions q, CancellationToken ct = default(CancellationToken))
 {
     KVPair.ValidatePath(key);
     return(_client.DeleteReturning <bool>(string.Format("/v1/kv/{0}", key.TrimStart('/')), q).Execute(ct));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Delete is used to delete a single key.
 /// </summary>
 /// <param name="key">The key name to delete</param>
 /// <param name="q">Customized write options</param>
 /// <returns>A write result indicating if the delete attempt succeeded</returns>
 public Task <WriteResult <bool> > Delete(string key, WriteOptions q)
 {
     KVPair.ValidatePath(key);
     return(_client.Delete <bool>(string.Format("/v1/kv/{0}", key), q).Execute());
 }