Module

Ctl.Internal.Testnet.Utils

#EventSource

newtype EventSource b

Constructors

#TestnetCleanupRef

#findNodeDirs

findNodeDirs :: { workdir :: FilePath } -> Effect (Array (Record (NodeLocation ())))

#onLine

onLine :: forall a b. Readable a -> (String -> Maybe b) -> Effect (EventSource b)

#makeEventSource

makeEventSource :: forall a b c. ({ handle :: Either Error a -> Effect Unit } -> Effect { outcome :: c, unsubscribe :: Effect Unit }) -> (a -> Maybe b) -> Effect { eventSource :: EventSource b, outcome :: c }

#findTestnetPaths

#getNodePort

getNodePort :: { nodeDir :: FilePath } -> Effect UInt

#scheduleCleanup

scheduleCleanup :: forall a. TestnetCleanupRef -> Aff a -> (a -> Aff Unit) -> Aff a

#tmpdirUnique

tmpdirUnique :: forall m. MonadEffect m => String -> m FilePath

#runCleanup

#tryAndLogErrors

tryAndLogErrors :: forall a m. MonadEffect m => MonadError Error m => String -> m a -> m (Either Error a)

#suppressAndLogErrors

#after

after :: forall a. Aff a -> (a -> Aff Unit) -> Aff a

Just as a bracket but without the body.

#parseEvent

#readNodes

readNodes :: forall r. { nodeDirs :: Array (Record (NodeLocation ())), testnetDirectory :: FilePath | r } -> Effect (Array (Record (Node ())))

#whenError

whenError :: forall (a :: Type). Aff Unit -> Aff a -> Aff a

#waitFor

waitFor :: forall a e. EventSource e -> (e -> Maybe a) -> Aff a

#waitForClose

waitForClose :: ManagedProcess -> Aff Unit

Waits until processe's stdout closes.

#waitForError

waitForError :: ManagedProcess -> Aff Error

Waits until processe's stdout closes.

#waitForEvent

waitForEvent :: forall a. EventSource a -> Aff a

Waits for any event. Note, if the event source throws an async error, any joining process dies.

#waitUntil

waitUntil :: forall a d. Duration d => d -> Aff (Maybe a) -> Aff a

#cleanupOnExit

cleanupOnExit :: Ref (Array (Aff Unit)) -> Aff { fiber :: Fiber Unit }

#annotateError

annotateError :: forall (a :: Type) m. MonadError Error m => String -> m a -> m a

Modules