Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Network.Protocol.Handshake.Version
Synopsis
- newtype Versions vNum vData r = Versions {
- getVersions :: Map vNum (Version vData r)
- updateVersionData :: (vData -> vData) -> Versions vNum vData r -> Versions vNum vData r
- data Version vData r = Version {
- versionApplication :: vData -> r
- versionData :: vData
- data VersionMismatch vNum where
- NoCommonVersion :: forall vNum. VersionMismatch vNum
- InconsistentVersion :: forall vNum. vNum -> VersionMismatch vNum
- simpleSingletonVersions :: vNum -> vData -> (vData -> r) -> Versions vNum vData r
- foldMapVersions :: (Ord vNum, Foldable f, HasCallStack) => (x -> Versions vNum extra r) -> f x -> Versions vNum extra r
- combineVersions :: (Ord vNum, Foldable f, HasCallStack) => f (Versions vNum extra r) -> Versions vNum extra r
- data Accept vData
- class Acceptable v where
- acceptableVersion :: v -> v -> Accept v
- class Queryable v where
- queryVersion :: v -> Bool
Documentation
newtype Versions vNum vData r Source #
The version map supported by the local agent keyed on the version identifier.
Each Version
contains a function which takes negotiated version data and
returns negotiated application (the r
type variable).
If one needs to combine multiple versions the simplest way is to use one of
the combinators: foldMapVersions
, combineVersions
or the Semigroup
instance directly:
fold $ (simpleSingletonVersions ...) :| [ (simpleSingletonVersions ...) , (simpleSingletonVersions ...) , ... ]
Constructors
Versions | |
Fields
|
updateVersionData :: (vData -> vData) -> Versions vNum vData r -> Versions vNum vData r Source #
Constructors
Version | |
Fields
|
data VersionMismatch vNum where Source #
Constructors
NoCommonVersion :: forall vNum. VersionMismatch vNum | |
InconsistentVersion :: forall vNum. vNum -> VersionMismatch vNum |
Simple or no versioning
simpleSingletonVersions Source #
Arguments
:: vNum | version number |
-> vData | proposed version data |
-> (vData -> r) | callback which receives negotiated version data |
-> Versions vNum vData r |
Singleton smart constructor for Versions
.
foldMapVersions :: (Ord vNum, Foldable f, HasCallStack) => (x -> Versions vNum extra r) -> f x -> Versions vNum extra r Source #
combineVersions :: (Ord vNum, Foldable f, HasCallStack) => f (Versions vNum extra r) -> Versions vNum extra r Source #
Re-exports
A
like type which better explains its purpose.Maybe
class Acceptable v where #
Methods
acceptableVersion :: v -> v -> Accept v #
The acceptableVersion
function ought to be symmetric, this guarantees
that local and remote sides will agree on the same data.
Instances
Instances
Queryable NodeToClientVersionData | |
Defined in Ouroboros.Network.NodeToClient.Version Methods | |
Queryable NodeToNodeVersionData | |
Defined in Ouroboros.Network.NodeToNode.Version Methods | |
Queryable DataFlowProtocolData Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Unversioned Methods | |
Queryable UnversionedProtocolData Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Unversioned Methods |