| 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 -> RunOptions -> Environment -> Party -> EventSource (StateEvent tx) IO -> Tracer IO APIServerLog -> ChainStateType tx -> 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 :: IsChainState tx => Maybe (Snapshot tx) -> StateEvent tx -> Maybe (TimedServerOutput tx)
- updateSeenSnapshot :: Maybe (Snapshot tx) -> StateChanged tx -> Maybe (Snapshot tx)
- seenSnapshotOf :: NodeState tx -> Maybe (Snapshot tx)
- projectPendingDeposits :: IsTx tx => [TxIdType tx] -> StateChanged tx -> [TxIdType tx]
- projectCommitInfo :: CommitInfo -> StateChanged tx -> CommitInfo
- projectNetworkInfo :: NetworkInfo -> StateChanged tx -> NetworkInfo
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 -> RunOptions -> Environment -> Party -> EventSource (StateEvent tx) IO -> Tracer IO APIServerLog -> ChainStateType tx -> 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 :: IsChainState tx => Maybe (Snapshot tx) -> StateEvent tx -> Maybe (TimedServerOutput tx) Source #
Defines the subset of StateEvent that should be sent as TimedServerOutput to clients.
The 'Maybe (Snapshot tx)' argument carries the snapshot currently being confirmed
(from the preceding SnapshotRequested event), needed to reconstruct
SnapshotConfirmed outputs when ServerOutput is absent from the event.
updateSeenSnapshot :: Maybe (Snapshot tx) -> StateChanged tx -> Maybe (Snapshot tx) Source #
Advance the seen-snapshot state as events are processed sequentially.
seenSnapshotOf :: NodeState tx -> Maybe (Snapshot tx) Source #
Extract the snapshot currently in SeenSnapshot from a NodeState, if any.
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 project HeadId when the Head is Open since that is when
deposits can be made.
projectNetworkInfo :: NetworkInfo -> StateChanged tx -> NetworkInfo Source #