Safe Haskell | None |
---|---|
Language | Haskell2010 |
Simple lib to access Etcd over gRPC.
Synopsis
- etcdClientConfigSimple :: HostName -> PortNumber -> UseTlsOrNot -> GrpcClientConfig
- type EtcdQuery a = IO (Maybe a)
- data KeyRange
- range :: GrpcClient -> KeyRange -> EtcdQuery RangeResponse
- rangeResponsePairs :: Getting (Endo [(ByteString, ByteString)]) RangeResponse (ByteString, ByteString)
- grantLease :: GrpcClient -> Int64 -> EtcdQuery LeaseGrantResponse
- fromLeaseGrantResponse :: LeaseGrantResponse -> GrantedLease
- keepAlive :: GrpcClient -> GrantedLease -> EtcdQuery LeaseKeepAliveResponse
- put :: GrpcClient -> ByteString -> ByteString -> Maybe GrantedLease -> EtcdQuery PutResponse
- def :: Default a => a
- module Control.Lens
- module Proto.Etcd.Etcdserver.Etcdserverpb.Rpc_Fields
- module Proto.Etcd.Etcdserver.Etcdserverpb.Rpc
Generalities.
etcdClientConfigSimple :: HostName -> PortNumber -> UseTlsOrNot -> GrpcClientConfig Source #
EtcdClient configuration.
Reading.
Data type to unify the three addressing schemes in etcd.
See range
.
SingleKey !ByteString | Exactly one key. |
FromKey !ByteString | |
Prefixed !ByteString |
:: GrpcClient | Initialized gRPC client. |
-> KeyRange | Looked-up range. |
-> EtcdQuery RangeResponse |
Lookup a range of values
rangeResponsePairs :: Getting (Endo [(ByteString, ByteString)]) RangeResponse (ByteString, ByteString) Source #
Specific fold to get the key-values of a RangeResponse
Typical usage is:
x <- range grpc (Prefixed "some-dir")
print $ x ^.. _Just . rangePairs
Note that Etcd RangeResponse is a rich object, please refer to Etcd documentation to understand what you will miss out (e.g., whether the list is complete or not).
Granting leases.
:: GrpcClient | Initialized gRPC client. |
-> Int64 | TTL for the lease. |
-> EtcdQuery LeaseGrantResponse |
Asks for a lease of a given duration.
fromLeaseGrantResponse :: LeaseGrantResponse -> GrantedLease Source #
Constructor for GrantedLease
.
:: GrpcClient | Initialized gRPC client. |
-> GrantedLease | A previously-granted lease. |
-> EtcdQuery LeaseKeepAliveResponse |
Keep a lease alive.
Writing.
:: GrpcClient | initialized gRPC client |
-> ByteString | Key. |
-> ByteString | Value. |
-> Maybe GrantedLease | Lease on the key. |
-> EtcdQuery PutResponse |
Put one value.
re-exports
module Control.Lens