Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
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 #
unWatchUnit :: MonadUnliftIO m => Watcher () b -> m () Source #
delete :: MonadUnliftIO m => Watcher a b -> m () Source #