Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype App m = App {
- unApp :: forall (t :: MessageType). Request t -> m (Response t)
- runApp :: forall m. Applicative m => App m -> LPByteStrings -> m LPByteStrings
- transformApp :: (forall (t :: MessageType). m (Response t) -> g (Response t)) -> App m -> App g
- withProto :: (forall (t :: MessageType). Request t -> a) -> Request'Value -> a
- type Middleware m = App m -> App m
- data MessageType
- demoteRequestType :: forall (t :: MessageType). Request t -> MessageType
- msgTypeKey :: MessageType -> String
- data Request (m :: MessageType) :: Type where
- RequestEcho :: Echo -> Request 'MTEcho
- RequestInfo :: Info -> Request 'MTInfo
- RequestSetOption :: SetOption -> Request 'MTSetOption
- RequestQuery :: Query -> Request 'MTQuery
- RequestCheckTx :: CheckTx -> Request 'MTCheckTx
- RequestFlush :: Flush -> Request 'MTFlush
- RequestInitChain :: InitChain -> Request 'MTInitChain
- RequestBeginBlock :: BeginBlock -> Request 'MTBeginBlock
- RequestDeliverTx :: DeliverTx -> Request 'MTDeliverTx
- RequestEndBlock :: EndBlock -> Request 'MTEndBlock
- RequestCommit :: Commit -> Request 'MTCommit
- hashRequest :: forall (t :: MessageType). Request t -> HexString
- data Response (m :: MessageType) :: Type where
- ResponseEcho :: Echo -> Response 'MTEcho
- ResponseFlush :: Flush -> Response 'MTFlush
- ResponseInfo :: Info -> Response 'MTInfo
- ResponseSetOption :: SetOption -> Response 'MTSetOption
- ResponseInitChain :: InitChain -> Response 'MTInitChain
- ResponseQuery :: Query -> Response 'MTQuery
- ResponseBeginBlock :: BeginBlock -> Response 'MTBeginBlock
- ResponseCheckTx :: CheckTx -> Response 'MTCheckTx
- ResponseDeliverTx :: DeliverTx -> Response 'MTDeliverTx
- ResponseEndBlock :: EndBlock -> Response 'MTEndBlock
- ResponseCommit :: Commit -> Response 'MTCommit
- ResponseException :: forall (m :: MessageType). Exception -> Response m
- newtype LPByteStrings = LPByteStrings {}
- decodeLengthPrefix :: LPByteStrings -> Either DecodeError [ByteString]
- encodeLengthPrefix :: [ByteString] -> LPByteStrings
Documentation
Application type that represents a well typed application, i.e. a
function from a typed Request
to a typed Response
.
App | |
|
runApp :: forall m. Applicative m => App m -> LPByteStrings -> m LPByteStrings Source #
Compiles App
down to AppBS
transformApp :: (forall (t :: MessageType). m (Response t) -> g (Response t)) -> App m -> App g Source #
Transform an application from running in a custom monad to running in IO
.
withProto :: (forall (t :: MessageType). Request t -> a) -> Request'Value -> a Source #
type Middleware m = App m -> App m Source #
Middleware is a component that sits between the server and application. It can do such tasks as logging or response caching. What follows is the general definition of middleware, though a middleware author should feel free to modify this.
data MessageType Source #
Used to parametrize Request and Response types
MTEcho | |
MTFlush | |
MTInfo | |
MTSetOption | |
MTInitChain | |
MTQuery | |
MTBeginBlock | |
MTCheckTx | |
MTDeliverTx | |
MTEndBlock | |
MTCommit |
Instances
Enum MessageType Source # | |
Defined in Network.ABCI.Server.App succ :: MessageType -> MessageType # pred :: MessageType -> MessageType # toEnum :: Int -> MessageType # fromEnum :: MessageType -> Int # enumFrom :: MessageType -> [MessageType] # enumFromThen :: MessageType -> MessageType -> [MessageType] # enumFromTo :: MessageType -> MessageType -> [MessageType] # enumFromThenTo :: MessageType -> MessageType -> MessageType -> [MessageType] # | |
Eq MessageType Source # | |
Defined in Network.ABCI.Server.App (==) :: MessageType -> MessageType -> Bool # (/=) :: MessageType -> MessageType -> Bool # | |
Ord MessageType Source # | |
Defined in Network.ABCI.Server.App compare :: MessageType -> MessageType -> Ordering # (<) :: MessageType -> MessageType -> Bool # (<=) :: MessageType -> MessageType -> Bool # (>) :: MessageType -> MessageType -> Bool # (>=) :: MessageType -> MessageType -> Bool # max :: MessageType -> MessageType -> MessageType # min :: MessageType -> MessageType -> MessageType # |
demoteRequestType :: forall (t :: MessageType). Request t -> MessageType Source #
msgTypeKey :: MessageType -> String Source #
data Request (m :: MessageType) :: Type where Source #
RequestEcho :: Echo -> Request 'MTEcho | |
RequestInfo :: Info -> Request 'MTInfo | |
RequestSetOption :: SetOption -> Request 'MTSetOption | |
RequestQuery :: Query -> Request 'MTQuery | |
RequestCheckTx :: CheckTx -> Request 'MTCheckTx | |
RequestFlush :: Flush -> Request 'MTFlush | |
RequestInitChain :: InitChain -> Request 'MTInitChain | |
RequestBeginBlock :: BeginBlock -> Request 'MTBeginBlock | |
RequestDeliverTx :: DeliverTx -> Request 'MTDeliverTx | |
RequestEndBlock :: EndBlock -> Request 'MTEndBlock | |
RequestCommit :: Commit -> Request 'MTCommit |
Instances
hashRequest :: forall (t :: MessageType). Request t -> HexString Source #
data Response (m :: MessageType) :: Type where Source #
ResponseEcho :: Echo -> Response 'MTEcho | |
ResponseFlush :: Flush -> Response 'MTFlush | |
ResponseInfo :: Info -> Response 'MTInfo | |
ResponseSetOption :: SetOption -> Response 'MTSetOption | |
ResponseInitChain :: InitChain -> Response 'MTInitChain | |
ResponseQuery :: Query -> Response 'MTQuery | |
ResponseBeginBlock :: BeginBlock -> Response 'MTBeginBlock | |
ResponseCheckTx :: CheckTx -> Response 'MTCheckTx | |
ResponseDeliverTx :: DeliverTx -> Response 'MTDeliverTx | |
ResponseEndBlock :: EndBlock -> Response 'MTEndBlock | |
ResponseCommit :: Commit -> Response 'MTCommit | |
ResponseException :: forall (m :: MessageType). Exception -> Response m |
Instances
newtype LPByteStrings Source #
ByteString which contains multiple length prefixed ByteStrings
Instances
Eq LPByteStrings Source # | |
Defined in Network.ABCI.Server.App (==) :: LPByteStrings -> LPByteStrings -> Bool # (/=) :: LPByteStrings -> LPByteStrings -> Bool # | |
Ord LPByteStrings Source # | |
Defined in Network.ABCI.Server.App compare :: LPByteStrings -> LPByteStrings -> Ordering # (<) :: LPByteStrings -> LPByteStrings -> Bool # (<=) :: LPByteStrings -> LPByteStrings -> Bool # (>) :: LPByteStrings -> LPByteStrings -> Bool # (>=) :: LPByteStrings -> LPByteStrings -> Bool # max :: LPByteStrings -> LPByteStrings -> LPByteStrings # min :: LPByteStrings -> LPByteStrings -> LPByteStrings # |
decodeLengthPrefix :: LPByteStrings -> Either DecodeError [ByteString] Source #
Decodes varlength-prefixed ByteString into ByteStrings
encodeLengthPrefix :: [ByteString] -> LPByteStrings Source #
Encodes ByteStrings into varlength-prefixed ByteString