lnd-client-0.1.0.0: Lightning Network Daemon (LND) client library for Haskell

Safe HaskellNone
LanguageHaskell2010

LndClient.Watcher

Description

Generic async worker to automate LND gRPC subscriptions. It watches any amount of subscriptions of the same type, and re-subscribes if subscription was not terminated properly. The only way to terminate subscription is to apply unWatch or unWatchUnit function.

Documentation

data Watcher a b Source #

spawnLink :: (Ord a, MonadUnliftIO m, KatipContext m) => LndEnv -> (Maybe (TChan (a, b)) -> LndEnv -> a -> m (Either LndError ())) -> (Watcher a b -> a -> Either LndError b -> m ()) -> m (Watcher a b) Source #

spawnLinkUnit :: (MonadUnliftIO m, KatipContext m) => LndEnv -> (Maybe (TChan ((), b)) -> LndEnv -> m (Either LndError ())) -> (Watcher () b -> Either LndError b -> m ()) -> m (Watcher () b) Source #

watch :: MonadUnliftIO m => Watcher a b -> a -> m () Source #

watchUnit :: MonadUnliftIO m => Watcher () b -> m () Source #

unWatch :: MonadUnliftIO m => Watcher a b -> a -> m () Source #

dupLndTChan :: MonadIO m => Watcher a b -> m (TChan (a, b)) Source #

delete :: MonadUnliftIO m => Watcher a b -> m () Source #