etcd is a highly-available key value store for shared configuration and service discovery written in the
Go language. Together with fleet, it forms the core of the cloud-specific linux distribution called
CoreOS. A Tcl
implementation of the
API is available on github. It was originally a component of the
biot project, but being self-contained, was forked out as a separate project.
EF 2015-01-21 An earlier version of this API used
::etcd::set and
::etcd::get to set and get keys, which interfered with the regular
set. The new version uses a different naming convention, in line with the
python API implementation. The new version also uses more complex semantics for
::etcd::read,
::etcd::write and
::etcd::delete, procedures that are used by most of the remaining procedures.
# Create a new connection context (defaults to default port on localhost)
set c [::etcd::new]
# Create a directory, and a sub-directory
::etcd::mkdir $c /onedir
::etcd::mkdir $c /onedir/asubdir
# Create and set a key:
::etcd::write $c /onedir/asubdir/test "Hello World"
# Get back the key
set k [::etcd::read $c /onedir/asubdir/test]
# Remove the key
::etcd::delete $c /onedir/asubdir/test
# Remove the directories, recursively
::etcd::rmdir $c /onedir 1
For a more detailed documentation, consult the
online manual.
While most operations can be performed using
curl,
etcd comes with a simple CLI client called
etcdctl. I have made available a
(re)implementation of this client, in Tcl. This is more meant as a testbed for the library above, but it also implements a functionality that is missing from the standard client, i.e. the ability to easily push the content of one or several files to the etcd key-space, using the same name as the file. Thus implementing a simplistic file mirroring facility.