Describes a ZooKeeper URL of the form: zk://username:password@servers/path Where username:password is for the 'digest' scheme (see ZooKeeper documentation regarding "access controls using ACLs") and servers is of the form: host1:port1,host2:port2,host3:port3 Note that in the future we may want to support authentication mechanisms other than 'digest' and have a URL of the following form. zk://
| 44 | // |
| 45 | // zk://scheme:credentials@servers/path |
| 46 | class URL |
| 47 | { |
| 48 | public: |
| 49 | static Try<URL> parse(const std::string& url); |
| 50 | |
| 51 | static const char* scheme() |
| 52 | { |
| 53 | return "zk://"; |
| 54 | } |
| 55 | |
| 56 | const Option<Authentication> authentication; |
| 57 | const std::string servers; |
| 58 | const std::string path; |
| 59 | |
| 60 | private: |
| 61 | URL(const std::string& _servers, |
| 62 | const std::string& _path) |
| 63 | : servers(_servers), |
| 64 | path(_path) {} |
| 65 | |
| 66 | URL(const std::string& credentials, |
| 67 | const std::string& _servers, |
| 68 | const std::string& _path) |
| 69 | : authentication(Authentication("digest", credentials)), |
| 70 | servers(_servers), |
| 71 | path(_path) {} |
| 72 | }; |
| 73 | |
| 74 | |
| 75 | inline Try<URL> URL::parse(const std::string& url) |
no outgoing calls