etcd 0.0.3

Dart native
Flutter Android iOS

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

2
likes
80
pub points
0%
popularity

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

Documentation

API reference

Uploader

bob.jackman@carruslearn.com

License

Apache 2.0 (LICENSE)

Dependencies

fixnum, grpc, logging, path, protobuf, stack_trace

More

Packages that depend on etcd