Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data CommandChannel = CommandChannel { }
- type Error a = Either Text a
- newtype LocalChannel = LocalChannel ( TChan Block)
- data ServerHandler = ServerHandler { }
-
data
ServerCommand
- = ProcessBlock
- | ModifySlot (Slot -> Slot)
- | AddTx ( Tx BabbageEra )
-
data
ServerResponse
- = BlockAdded Block
- | SlotChanged Slot
- processBlock :: MonadIO m => ServerHandler -> m Block
- modifySlot :: MonadIO m => (Slot -> Slot) -> ServerHandler -> m Slot
- addTx :: MonadIO m => ServerHandler -> Tx BabbageEra -> m ()
- pruneChain :: MonadIO m => Integer -> TChan Block -> m ThreadId
- handleCommand :: MonadIO m => Trace IO PABServerLogMsg -> CommandChannel -> MVar MockNodeServerChainState -> Params -> m ()
- runServerNode :: MonadIO m => Trace IO PABServerLogMsg -> FilePath -> Integer -> MockNodeServerChainState -> Params -> m ServerHandler
- type ChainSyncMonad = ReaderT ( MVar MockNodeServerChainState ) IO
- runChainSync :: MVar MockNodeServerChainState -> ChainSyncMonad a -> IO a
- idleState :: ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => LocalChannel -> m ( ServerStIdle Block ( Point Block) Tip m ())
- nextState :: ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => LocalChannel -> m ( Either ( ServerStNext Block ( Point Block) Tip m ()) (m ( ServerStNext Block ( Point Block) Tip m ())))
- findIntersect :: ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => [ Point Block] -> m ( ServerStIntersect Block ( Point Block) Tip m ())
- sendRollForward :: ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => LocalChannel -> Block -> Block -> m ( ServerStNext Block ( Point Block) Tip m ())
- chainSyncServer :: ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => ChainSyncServer Block ( Point Block) Tip m ()
- cloneChainFrom :: forall m. ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => Integer -> m LocalChannel
- hoistChainSync :: MonadReader ( MVar MockNodeServerChainState ) m => ChainSyncServer Block ( Point Block) Tip ChainSyncMonad a -> m ( ChainSyncServer Block ( Point Block) Tip IO a)
- hoistStIdle :: MonadReader ( MVar MockNodeServerChainState ) m => ServerStIdle Block ( Point Block) Tip ChainSyncMonad a -> m ( ServerStIdle Block ( Point Block) Tip IO a)
- hoistStIntersect :: MonadReader ( MVar MockNodeServerChainState ) m => ServerStIntersect Block ( Point Block) Tip ChainSyncMonad a -> m ( ServerStIntersect Block ( Point Block) Tip IO a)
- hoistStNext :: MonadReader ( MVar MockNodeServerChainState ) m => ServerStNext Block ( Point Block) Tip ChainSyncMonad a -> m ( ServerStNext Block ( Point Block) Tip IO a)
- protocolLoop :: MonadIO m => FilePath -> MVar MockNodeServerChainState -> m Void
- nodeToClientProtocols :: MVar MockNodeServerChainState -> NodeToClientProtocols ' ResponderMode ByteString IO Void ()
- chainSync :: MVar MockNodeServerChainState -> RunMiniProtocol ' ResponderMode ByteString IO Void ()
- txSubmission :: MVar MockNodeServerChainState -> RunMiniProtocol ' ResponderMode ByteString IO Void ()
- pointOffset :: Point Block -> Integer
- getChainPoints :: MonadIO m => TChan Block -> MockNodeServerChainState -> m [ Point Block]
- txSubmissionServer :: MVar MockNodeServerChainState -> LocalTxSubmissionServer ( Tx BabbageEra ) String IO ()
Documentation
data CommandChannel Source #
newtype LocalChannel Source #
Clone the original channel for each connected client, then use this wrapper to make sure that no data is consumed from the original channel.
LocalChannel ( TChan Block) |
data ServerHandler Source #
A handler used to pass around the path to the server and channels used for controlling the server.
data ServerCommand Source #
The commands that control the server. This API is not part of the client interface, and in order to call them directly you will need access to the returned ServerHandler
ProcessBlock | |
ModifySlot (Slot -> Slot) | |
AddTx ( Tx BabbageEra ) |
Instances
Show ServerCommand Source # | |
Defined in Cardano.Protocol.Socket.Mock.Server |
data ServerResponse Source #
The response from the server. Can be used for the information passed back, or for synchronisation.
BlockAdded Block | |
SlotChanged Slot |
Instances
Show ServerResponse Source # | |
Defined in Cardano.Protocol.Socket.Mock.Server |
processBlock :: MonadIO m => ServerHandler -> m Block Source #
modifySlot :: MonadIO m => (Slot -> Slot) -> ServerHandler -> m Slot Source #
addTx :: MonadIO m => ServerHandler -> Tx BabbageEra -> m () Source #
handleCommand :: MonadIO m => Trace IO PABServerLogMsg -> CommandChannel -> MVar MockNodeServerChainState -> Params -> m () Source #
runServerNode :: MonadIO m => Trace IO PABServerLogMsg -> FilePath -> Integer -> MockNodeServerChainState -> Params -> m ServerHandler Source #
Start the server in a new thread, and return a server handler used to control the server
ChainSync protocol
type ChainSyncMonad = ReaderT ( MVar MockNodeServerChainState ) IO Source #
runChainSync :: MVar MockNodeServerChainState -> ChainSyncMonad a -> IO a Source #
idleState :: ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => LocalChannel -> m ( ServerStIdle Block ( Point Block) Tip m ()) Source #
nextState :: ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => LocalChannel -> m ( Either ( ServerStNext Block ( Point Block) Tip m ()) (m ( ServerStNext Block ( Point Block) Tip m ()))) Source #
findIntersect :: ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => [ Point Block] -> m ( ServerStIntersect Block ( Point Block) Tip m ()) Source #
sendRollForward :: ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => LocalChannel -> Block -> Block -> m ( ServerStNext Block ( Point Block) Tip m ()) Source #
chainSyncServer :: ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => ChainSyncServer Block ( Point Block) Tip m () Source #
cloneChainFrom :: forall m. ( MonadReader ( MVar MockNodeServerChainState ) m, MonadIO m) => Integer -> m LocalChannel Source #
Protocol setup
hoistChainSync :: MonadReader ( MVar MockNodeServerChainState ) m => ChainSyncServer Block ( Point Block) Tip ChainSyncMonad a -> m ( ChainSyncServer Block ( Point Block) Tip IO a) Source #
hoistStIdle :: MonadReader ( MVar MockNodeServerChainState ) m => ServerStIdle Block ( Point Block) Tip ChainSyncMonad a -> m ( ServerStIdle Block ( Point Block) Tip IO a) Source #
hoistStIntersect :: MonadReader ( MVar MockNodeServerChainState ) m => ServerStIntersect Block ( Point Block) Tip ChainSyncMonad a -> m ( ServerStIntersect Block ( Point Block) Tip IO a) Source #
hoistStNext :: MonadReader ( MVar MockNodeServerChainState ) m => ServerStNext Block ( Point Block) Tip ChainSyncMonad a -> m ( ServerStNext Block ( Point Block) Tip IO a) Source #
protocolLoop :: MonadIO m => FilePath -> MVar MockNodeServerChainState -> m Void Source #
nodeToClientProtocols :: MVar MockNodeServerChainState -> NodeToClientProtocols ' ResponderMode ByteString IO Void () Source #
chainSync :: MVar MockNodeServerChainState -> RunMiniProtocol ' ResponderMode ByteString IO Void () Source #
txSubmission :: MVar MockNodeServerChainState -> RunMiniProtocol ' ResponderMode ByteString IO Void () Source #
Computing intersections
pointOffset :: Point Block -> Integer Source #
getChainPoints :: MonadIO m => TChan Block -> MockNodeServerChainState -> m [ Point Block] Source #