Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 SerialiseNodeToClient blk a where
- encodeNodeToClient ∷ CodecConfig blk → BlockNodeToClientVersion blk → a → Encoding
- decodeNodeToClient ∷ CodecConfig blk → BlockNodeToClientVersion blk → ∀ s. Decoder s a
- class SerialiseNodeToNode blk a where
- encodeNodeToNode ∷ CodecConfig blk → BlockNodeToNodeVersion blk → a → Encoding
- decodeNodeToNode ∷ CodecConfig blk → BlockNodeToNodeVersion blk → ∀ s. Decoder s a
- class SerialiseResult blk query where
- encodeResult ∷ ∀ result. CodecConfig blk → BlockNodeToClientVersion blk → query result → result → Encoding
- decodeResult ∷ ∀ result. CodecConfig blk → BlockNodeToClientVersion blk → query result → ∀ s. Decoder s result
- defaultDecodeCBORinCBOR ∷ Serialise a ⇒ Decoder s a
- defaultEncodeCBORinCBOR ∷ Serialise a ⇒ a → Encoding
- data Some (f ∷ k → Type) where
Documentation
class SerialiseNodeToClient blk a where Source #
Serialise a type a
so that it can be sent across the network via
node-to-client protocol.
Nothing
encodeNodeToClient ∷ CodecConfig blk → BlockNodeToClientVersion blk → a → Encoding Source #
default encodeNodeToClient ∷ Serialise a ⇒ CodecConfig blk → BlockNodeToClientVersion blk → a → Encoding Source #
decodeNodeToClient ∷ CodecConfig blk → BlockNodeToClientVersion blk → ∀ s. Decoder s a Source #
default decodeNodeToClient ∷ Serialise a ⇒ CodecConfig blk → BlockNodeToClientVersion blk → ∀ s. Decoder s a Source #
Instances
class SerialiseNodeToNode blk a where Source #
Serialise a type a
so that it can be sent across network via a
node-to-node protocol.
Nothing
encodeNodeToNode ∷ CodecConfig blk → BlockNodeToNodeVersion blk → a → Encoding Source #
default encodeNodeToNode ∷ Serialise a ⇒ CodecConfig blk → BlockNodeToNodeVersion blk → a → Encoding Source #
decodeNodeToNode ∷ CodecConfig blk → BlockNodeToNodeVersion blk → ∀ s. Decoder s a Source #
default decodeNodeToNode ∷ Serialise a ⇒ CodecConfig blk → BlockNodeToNodeVersion blk → ∀ 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.
encodeResult ∷ ∀ result. CodecConfig blk → BlockNodeToClientVersion blk → query result → result → Encoding Source #
decodeResult ∷ ∀ result. CodecConfig blk → BlockNodeToClientVersion blk → query result → ∀ s. Decoder s result Source #
Instances
(SerialiseResult blk (BlockQuery blk), Serialise (HeaderHash blk)) ⇒ SerialiseResult blk (Query blk) Source # | |
Defined in Ouroboros.Consensus.Ledger.Query encodeResult ∷ CodecConfig blk → BlockNodeToClientVersion blk → Query blk result → result → Encoding Source # decodeResult ∷ CodecConfig blk → BlockNodeToClientVersion blk → Query blk result → ∀ s. Decoder s result Source # | |
SerialiseHFC xs ⇒ SerialiseResult (HardForkBlock xs) (BlockQuery (HardForkBlock xs)) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Serialisation.SerialiseNodeToClient encodeResult ∷ CodecConfig (HardForkBlock xs) → BlockNodeToClientVersion (HardForkBlock xs) → BlockQuery (HardForkBlock xs) result → result → Encoding Source # decodeResult ∷ CodecConfig (HardForkBlock xs) → BlockNodeToClientVersion (HardForkBlock xs) → BlockQuery (HardForkBlock xs) result → ∀ s. Decoder s result Source # |
Defaults
defaultDecodeCBORinCBOR ∷ Serialise a ⇒ Decoder s a Source #
Inverse of defaultEncodeCBORinCBOR
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.
Re-exported for convenience
data Some (f ∷ k → Type) where Source #
Instances
Serialise (Some QueryAnytime) Source # | |
Defined in Ouroboros.Consensus.HardFork.Combinator.Ledger.Query encode ∷ Some QueryAnytime → Encoding Source # decode ∷ Decoder s (Some QueryAnytime) Source # encodeList ∷ [Some QueryAnytime] → Encoding Source # decodeList ∷ Decoder s [Some QueryAnytime] Source # |