17 #ifndef __MESOS_ZOOKEEPER_URL_HPP__ 18 #define __MESOS_ZOOKEEPER_URL_HPP__ 61 URL(
const std::string& _servers,
62 const std::string& _path)
66 URL(
const std::string& credentials,
67 const std::string& _servers,
68 const std::string& _path)
80 return Error(
"Expecting 'zk://' at the beginning of the URL");
87 size_t index = s.find_last_of(
'/');
89 if (index == std::string::npos) {
92 path = s.substr(index) +
path;
93 s = s.substr(0, index);
102 size_t index = s.find_last_of(
'@');
104 if (index != std::string::npos) {
105 return URL(s.substr(0, index), s.substr(index + 1),
path);
122 #endif // __MESOS_ZOOKEEPER_URL_HPP__ const std::string servers
Definition: url.hpp:57
const std::string path
Definition: url.hpp:58
std::ostream & operator<<(std::ostream &stream, const Authentication &authentication)
Definition: authentication.hpp:61
Definition: errorbase.hpp:36
Definition: option.hpp:29
Result< int > index(const std::string &link)
Definition: authentication.hpp:33
Definition: authentication.hpp:35
static Try< URL > parse(const std::string &url)
Definition: url.hpp:75
bool startsWith(const std::string &s, const std::string &prefix)
Definition: strings.hpp:381
static const char * scheme()
Definition: url.hpp:51
std::string trim(const std::string &from, Mode mode=ANY, const std::string &chars=WHITESPACE)
Definition: strings.hpp:67
const Option< Authentication > authentication
Definition: url.hpp:56