| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.API.Server
Synopsis
- newtype Server tx m = Server {
- sendMessage :: ClientMessage tx -> m ()
- data APIServerConfig = APIServerConfig {}
- withAPIServer :: forall tx. IsChainState tx => APIServerConfig -> Environment -> Party -> EventSource (StateEvent tx) IO -> Tracer IO APIServerLog -> Chain tx IO -> PParams LedgerEra -> ServerOutputFilter tx -> (ClientInput tx -> IO ()) -> ((EventSink (StateEvent tx) IO, Server tx IO) -> IO ()) -> IO ()
- data RunServerException = RunServerException {
- ioException :: IOException
- host :: IP
- port :: PortNumber
- type NotifyServerRunning = IO ()
- type WaitForServer = IO ()
- setupServerNotification :: IO (NotifyServerRunning, WaitForServer)
- mkTimedServerOutputFromStateEvent :: IsTx tx => StateEvent tx -> Maybe (TimedServerOutput tx)
- projectPendingDeposits :: IsTx tx => [TxIdType tx] -> StateChanged tx -> [TxIdType tx]
- projectCommitInfo :: CommitInfo -> StateChanged tx -> CommitInfo
- projectInitializingHeadId :: Maybe HeadId -> StateChanged tx -> Maybe HeadId
Documentation
Handle to provide a means for sending server outputs to clients.
Constructors
| Server | |
Fields
| |
data APIServerConfig Source #
Constructors
| APIServerConfig | |
Fields | |
withAPIServer :: forall tx. IsChainState tx => APIServerConfig -> Environment -> Party -> EventSource (StateEvent tx) IO -> Tracer IO APIServerLog -> Chain tx IO -> PParams LedgerEra -> ServerOutputFilter tx -> (ClientInput tx -> IO ()) -> ((EventSink (StateEvent tx) IO, Server tx IO) -> IO ()) -> IO () Source #
data RunServerException Source #
An IOException with more IP and PortNumber added as context.
Constructors
| RunServerException | |
Fields
| |
Instances
| Exception RunServerException Source # | |
Defined in Hydra.API.Server Methods toException :: RunServerException -> SomeException Source # fromException :: SomeException -> Maybe RunServerException Source # | |
| Show RunServerException Source # | |
Defined in Hydra.API.Server | |
type NotifyServerRunning = IO () Source #
type WaitForServer = IO () Source #
setupServerNotification :: IO (NotifyServerRunning, WaitForServer) Source #
Setup notification and waiter to ensure that something only runs after the server is actually listening.
mkTimedServerOutputFromStateEvent :: IsTx tx => StateEvent tx -> Maybe (TimedServerOutput tx) Source #
Defines the subset of StateEvent that should be sent as TimedServerOutput to clients.
projectPendingDeposits :: IsTx tx => [TxIdType tx] -> StateChanged tx -> [TxIdType tx] Source #
Projection to obtain the list of pending deposits.
projectCommitInfo :: CommitInfo -> StateChanged tx -> CommitInfo Source #
Projection to obtain CommitInfo needed to draft commit transactions.
NOTE: We only want to project HeadId when the Head is in the Initializing
state since this is when Head parties need to commit some funds.
projectInitializingHeadId :: Maybe HeadId -> StateChanged tx -> Maybe HeadId Source #
Projection to obtain the HeadId needed to draft a commit transaction.
NOTE: We only want to project HeadId when the Head is in the Initializing
state since this is when Head parties need to commit some funds.