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
- data GrantedLease
- fromLeaseGrantResponse :: LeaseGrantResponse -> GrantedLease
- keepAlive :: GrpcClient -> GrantedLease -> EtcdQuery LeaseKeepAliveResponse
- put :: GrpcClient -> ByteString -> ByteString -> Maybe GrantedLease -> EtcdQuery PutResponse
- delete :: GrpcClient -> KeyRange -> EtcdQuery DeleteRangeResponse
- data AcquiredLock
- fromLockResponse :: LockResponse -> AcquiredLock
- lock :: GrpcClient -> ByteString -> GrantedLease -> EtcdQuery LockResponse
- unlock :: GrpcClient -> AcquiredLock -> EtcdQuery UnlockResponse
- def :: Default a => a
- module Control.Lens
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.
data GrantedLease Source #
Opaque lease result.
Show instance used for printing purposes only.
Instances
Show GrantedLease Source # | |
Defined in Network.EtcdV3 showsPrec :: Int -> GrantedLease -> ShowS # show :: GrantedLease -> String # showList :: [GrantedLease] -> ShowS # |
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.
:: GrpcClient | Initialized gRPC client. |
-> KeyRange | Deleted range. |
-> EtcdQuery DeleteRangeResponse |
Delete a range of values.
Locking.
data AcquiredLock Source #
Opaque lock.
Show instance used for printing purposes only.
Instances
Show AcquiredLock Source # | |
Defined in Network.EtcdV3 showsPrec :: Int -> AcquiredLock -> ShowS # show :: AcquiredLock -> String # showList :: [AcquiredLock] -> ShowS # |
:: GrpcClient | Initialized gRPC client. |
-> ByteString | Lock Name |
-> GrantedLease | Previously-granted lease that will bound the lifetime of the lock ownership. |
-> EtcdQuery LockResponse |
:: GrpcClient | Initialized gRPC client. |
-> AcquiredLock | Previously-acquired lock. |
-> EtcdQuery UnlockResponse |
re-exports
module Control.Lens