| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Ouroboros.Consensus.Node.Serialisation
Description
Serialisation for sending things across the network.
We separate NodeToNode from NodeToClient to be very explicit about what
gets sent where.
Unlike in Ouroboros.Consensus.Storage.Serialisation, we don't separate the encoder from the decoder, because the reasons don't apply: we always need both directions and we don't have access to the bytestrings that could be used for the annotations (we use CBOR-in-CBOR in those cases).
Synopsis
- class SerialiseNodeToNode blk a where
- encodeNodeToNode :: CodecConfig blk -> BlockNodeToNodeVersion blk -> a -> Encoding
- decodeNodeToNode :: CodecConfig blk -> BlockNodeToNodeVersion blk -> forall s. Decoder s a
- class SerialiseNodeToClient blk a where
- encodeNodeToClient :: CodecConfig blk -> BlockNodeToClientVersion blk -> a -> Encoding
- decodeNodeToClient :: CodecConfig blk -> BlockNodeToClientVersion blk -> forall s. Decoder s a
- class SerialiseResult blk query where
- encodeResult :: forall result. CodecConfig blk -> BlockNodeToClientVersion blk -> query result -> result -> Encoding
- decodeResult :: forall result. CodecConfig blk -> BlockNodeToClientVersion blk -> query result -> forall s. Decoder s result
- defaultEncodeCBORinCBOR :: Serialise a => a -> Encoding
- defaultDecodeCBORinCBOR :: Serialise a => Decoder s a
- data Some (f :: k -> Type) where
Documentation
class SerialiseNodeToNode blk a where Source #
Serialise a type a so that it can be sent across network via a
node-to-node protocol.
Minimal complete definition
Nothing
Methods
encodeNodeToNode :: CodecConfig blk -> BlockNodeToNodeVersion blk -> a -> Encoding Source #
default encodeNodeToNode :: Serialise a => CodecConfig blk -> BlockNodeToNodeVersion blk -> a -> Encoding Source #
decodeNodeToNode :: CodecConfig blk -> BlockNodeToNodeVersion blk -> forall s. Decoder s a Source #
default decodeNodeToNode :: Serialise a => CodecConfig blk -> BlockNodeToNodeVersion blk -> forall s. Decoder s a Source #
Instances
class SerialiseNodeToClient blk a where Source #
Serialise a type a so that it can be sent across the network via
node-to-client protocol.
Minimal complete definition
Nothing
Methods
encodeNodeToClient :: CodecConfig blk -> BlockNodeToClientVersion blk -> a -> Encoding Source #
default encodeNodeToClient :: Serialise a => CodecConfig blk -> BlockNodeToClientVersion blk -> a -> Encoding Source #
decodeNodeToClient :: CodecConfig blk -> BlockNodeToClientVersion blk -> forall s. Decoder s a Source #
default decodeNodeToClient :: Serialise a => CodecConfig blk -> BlockNodeToClientVersion blk -> forall s. Decoder s a Source #
Instances
class SerialiseResult blk query where Source #
How to serialise the result of the result of a query.
The LocalStateQuery protocol is a node-to-client protocol, hence the
NodeToClientVersion argument.
Methods
encodeResult :: forall result. CodecConfig blk -> BlockNodeToClientVersion blk -> query result -> result -> Encoding Source #
decodeResult :: forall result. CodecConfig blk -> BlockNodeToClientVersion blk -> query result -> forall s. Decoder s result Source #
Instances
| SerialiseHFC xs => SerialiseResult (HardForkBlock xs) (Query (HardForkBlock xs)) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.SerialiseNodeToClient Methods encodeResult :: CodecConfig (HardForkBlock xs) -> BlockNodeToClientVersion (HardForkBlock xs) -> Query (HardForkBlock xs) result -> result -> Encoding Source # decodeResult :: CodecConfig (HardForkBlock xs) -> BlockNodeToClientVersion (HardForkBlock xs) -> Query (HardForkBlock xs) result -> forall s. Decoder s result Source # | |
Defaults
defaultEncodeCBORinCBOR :: Serialise a => a -> Encoding Source #
Uses the Serialise instance, but wraps it in CBOR-in-CBOR.
Use this for the SerialiseNodeToNode and/or SerialiseNodeToClient
instance of blk and/or , which require CBOR-in-CBOR to be
compatible with the corresponding Header blkSerialised instance.
defaultDecodeCBORinCBOR :: Serialise a => Decoder s a Source #
Inverse of defaultEncodeCBORinCBOR
Re-exported for convenience
data Some (f :: k -> Type) where #
Instances
| Serialise (Some QueryAnytime) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query Methods encode :: Some QueryAnytime -> Encoding Source # decode :: Decoder s (Some QueryAnytime) Source # encodeList :: [Some QueryAnytime] -> Encoding Source # decodeList :: Decoder s [Some QueryAnytime] Source # | |