## Not run:
# # make a client
# cli <- etcd()
#
# # Make a key
# cli$create(key="/mykey", value="this is awesome")
# cli$create(key="/things", value="and stuff!")
# ## use ttl (expires after ttl seconds)
# cli$create(key="/stuff", value="tables", ttl=10)
#
# # Make a directory
# cli$create(key="/mydir", dir = TRUE)
# # List a directory
# cli$key("/mydir")
# # Make a key inside a directory
# cli$create("/mydir/key1", value = "foo")
# cli$create("/mydir/key2", value = "bar")
# # List again, now with two keys
# cli$key("/mydir")
# # Delete a directory
# cli$delete(key="/mydir", dir = TRUE)
#
# # Update a key
# cli$update(key="/things", value="and stuff! and more things")
#
# # Create an in-order key
# cli$create_inorder("/queue", "thing1")
# cli$create_inorder("/queue", "thing2")
# cli$create_inorder("/queue", "thing3")
# cli$key("/queue", sorted = TRUE, recursive = TRUE)
#
# # List all keys
# cli$keys()
# cli$keys(sorted = TRUE)
# cli$keys(recursive = TRUE)
# cli$keys(sorted = TRUE, recursive = TRUE)
#
# # List a single key
# cli$key("/mykey")
# cli$key("/things")
#
# # Waiting
# ## Wait for a change via long-polling
# ## in another R session, load etseed, then run the 2nd line of code
# # cli$key("/anewkey", wait = TRUE)
# # cli$create("/anewkey", "hey from another R session")
# ## Wait for change from cleared event index
# # cli$key("/anewkey", wait = TRUE, wait_index = 7)
#
# # Delete a key
# cli$create("/hello", "world")
# cli$delete("/hello")
# ## Delete only if matches previous value, fails
# cli$delete("/things", prevValue="two")
# ## Delete only if matches previous index
# ### Fails
# cli$delete("/things", prevIndex=1)
# ### Works
# cli$delete("/things", prevIndex=13)
#
# # curl options
# library("httr")
# cli$keys(config = verbose())
#
# # Hidden keys
# ## Create a hidden key using "_" at beginning
# cli$create("/_message", "my hidden key")
# ## A key that's not hidden
# cli$create("/message", "my un-hidden key")
# ## Call to root directory doesn't show the hidden key
# cli$keys()
#
# # Set a key from a file
# # cat("hello\nworld", file = "myfile.txt")
# # cli$create("/myfile", file = file)
# ## End(Not run)
Run the code above in your browser using DataLab