Removed mkdir
This commit is contained in:
parent
366f10506c
commit
029f46df86
|
|
@ -102,11 +102,6 @@ namespace etcd
|
||||||
*/
|
*/
|
||||||
pplx::task<Response> ls(std::string const & key);
|
pplx::task<Response> ls(std::string const & key);
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new directory node. Fails if the parent directory dos not exists or not a directory.
|
|
||||||
* @param key is the directory to be created to be listed
|
|
||||||
*/
|
|
||||||
pplx::task<Response> mkdir(std::string const & key);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a directory node. Fails if the parent directory dos not exists or not a directory.
|
* Removes a directory node. Fails if the parent directory dos not exists or not a directory.
|
||||||
|
|
@ -135,10 +130,6 @@ namespace etcd
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
pplx::task<Response> send_put_request(web::http::uri_builder & uri, std::string const & key, std::string const & value);
|
|
||||||
|
|
||||||
web::http::client::http_client client;
|
|
||||||
|
|
||||||
std::unique_ptr<KV::Stub> stub_;
|
std::unique_ptr<KV::Stub> stub_;
|
||||||
std::unique_ptr<Watch::Stub> watchServiceStub;
|
std::unique_ptr<Watch::Stub> watchServiceStub;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ using etcdserverpb::WatchResponse;
|
||||||
using etcdserverpb::WatchCreateRequest;
|
using etcdserverpb::WatchCreateRequest;
|
||||||
|
|
||||||
etcd::Client::Client(std::string const & address)
|
etcd::Client::Client(std::string const & address)
|
||||||
: client(address)
|
|
||||||
{
|
{
|
||||||
std::string stripped_address(address);
|
std::string stripped_address(address);
|
||||||
std::string substr("http://");
|
std::string substr("http://");
|
||||||
|
|
@ -34,12 +33,6 @@ etcd::Client::Client(std::string const & address)
|
||||||
watchServiceStub= Watch::NewStub(channel);
|
watchServiceStub= Watch::NewStub(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
pplx::task<etcd::Response> etcd::Client::send_put_request(web::http::uri_builder & uri, std::string const & key, std::string const & value)
|
|
||||||
{
|
|
||||||
std::string data = key + "=" + value;
|
|
||||||
std::string content_type = "application/x-www-form-urlencoded; param=" + key;
|
|
||||||
return Response::create(client.request(web::http::methods::PUT, uri.to_string(), data.c_str(), content_type.c_str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
pplx::task<etcd::Response> etcd::Client::get(std::string const & key)
|
pplx::task<etcd::Response> etcd::Client::get(std::string const & key)
|
||||||
{
|
{
|
||||||
|
|
@ -93,12 +86,6 @@ pplx::task<etcd::Response> etcd::Client::rm_if(std::string const & key, int old_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pplx::task<etcd::Response> etcd::Client::mkdir(std::string const & key)
|
|
||||||
{
|
|
||||||
web::http::uri_builder uri("/v2/keys" + key);
|
|
||||||
return send_put_request(uri, "dir", "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pplx::task<etcd::Response> etcd::Client::rmdir(std::string const & key, bool recursive)
|
pplx::task<etcd::Response> etcd::Client::rmdir(std::string const & key, bool recursive)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue