Skip to content

Commit

Permalink
doc: Updates README to add server creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgockel committed Feb 24, 2018
1 parent e8b81f3 commit 6082e97
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Ultimately, the usage looks like this (assuming you have a ZooKeeper server runn

#include <zk/client.hpp>
#include <zk/multi.hpp>
#include <zk/server/configuration.hpp>
#include <zk/server/server.hpp>

#include <exception>
#include <iostream>
Expand All @@ -59,8 +61,12 @@ Ultimately, the usage looks like this (assuming you have a ZooKeeper server runn

int main()
{
// zk::client::create returns a future<zk::client>, which is delivered when the connection is established.
auto client = zk::client::create("zk://127.0.0.1:2181")
// Start a ZK server running on localhost (not needed if you just want a client, but great for testing and
// demonstration purposes).
zk::server::server server(zk::server::configuration::make_minimal("zk-data", 2181));

// zk::client::connect returns a future<zk::client>, which is delivered when the connection is established.
auto client = zk::client::connect("zk://127.0.0.1:2181")
.get();

// get_result has a zk::buffer and zk::stat.
Expand Down

0 comments on commit 6082e97

Please sign in to comment.