Bitbucket Pipelines branch Codecov Dart Version extra_pedantic on pub.dev License

A client library for connecting to and interacting with ETCD, a distributed, reliable key-value store for the most critical data of a distributed system

Usage

Create a client:

var client = new EtcdClient('etcd.example.com', port: 2379, options: new ChannelOptions(credentials: ChannelCredentials.insecure()));

Fetch a value:

var currentValue = await client.kv.fetch('myKey');

Set/Update a value:

await client.kv.put('myKey', 'myValue');

Attach a lease to a value:

var lease = await client.lease.grant(Duration(seconds: 5));
await client.kv.put('myKey', 'myValue', lease: lease.id);

Check remaining time on a lease:

var remainingTTL = await client.lease.timeToLive(lease.id, listKeys: true);

Renew a lease:

await lease.keepAlive();

Revoke a lease (and the values its attached to):

await client.lease.revoke(lease.id);

Watch a value for changes:

var watcher = await client.watch.single(KEY, prevKv: true);
watcher.listen((EtcdWatchEvent event) {
  switch (event.type) {
    case EtcdWatchEventType.PUT:
      print('Key `${event.kv.key}` modified: replaced value `${event.prevKv.value}` with `${event.kv.value}`');
      break;

    case EtcdWatchEventType.DELETE:
      print('Key `${event.kv.key}` was deleted: deleted value was `${event.prevKv.value}`');
      break;
  }
});

Features and bugs

For now, please file feature requests and bugs by emailing the author

Libraries

annotations.pb
annotations.pbenum
annotations.pbjson
auth.pb
auth.pbenum
auth.pbjson
etcd
gogo.pb
gogo.pbenum
gogo.pbjson
http.pb
http.pbenum
http.pbjson
kv.pb
kv.pbenum
kv.pbjson
rpc.pb
rpc.pbenum
rpc.pbgrpc
rpc.pbjson