etcd 0.0.6 copy "etcd: ^0.0.6" to clipboard
etcd: ^0.0.6 copied to clipboard

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

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

3
likes
40
pub points
0%
popularity

Publisher

unverified uploader

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

Homepage
Repository

License

Apache-2.0 (LICENSE)

Dependencies

fixnum, grpc, logging, path, protobuf, stack_trace

More

Packages that depend on etcd