Safe Haskell | None |
---|---|
Language | Haskell2010 |
API for running Handshake
protocol.
Synopsis
- runHandshakeClient :: (MonadAsync m, MonadFork m, MonadTimer m, MonadMask m, MonadThrow (STM m), Ord vNumber) => MuxBearer m -> connectionId -> HandshakeArguments connectionId vNumber vData m -> Versions vNumber vData application -> m (Either (HandshakeException vNumber) (HandshakeResult application vNumber vData))
- runHandshakeServer :: (MonadAsync m, MonadFork m, MonadTimer m, MonadMask m, MonadThrow (STM m), Ord vNumber) => MuxBearer m -> connectionId -> HandshakeArguments connectionId vNumber vData m -> Versions vNumber vData application -> m (Either (HandshakeException vNumber) (HandshakeResult application vNumber vData))
- data HandshakeArguments connectionId vNumber vData (m :: Type -> Type) = HandshakeArguments {
- haHandshakeTracer :: Tracer m (WithMuxBearer connectionId (TraceSendRecv (Handshake vNumber Term)))
- haHandshakeCodec :: Codec (Handshake vNumber Term) DeserialiseFailure m ByteString
- haVersionDataCodec :: VersionDataCodec Term vNumber vData
- haAcceptVersion :: vData -> vData -> Accept vData
- haQueryVersion :: vData -> Bool
- haTimeLimits :: ProtocolTimeLimits (Handshake vNumber Term)
- newtype Versions vNum vData r = Versions {
- getVersions :: Map vNum (Version vData r)
- data HandshakeException vNumber
- data HandshakeProtocolError vNumber
- = HandshakeError (RefuseReason vNumber)
- | NotRecognisedVersion vNumber
- | InvalidServerSelection vNumber Text
- | QueryNotSupported
- data HandshakeResult r vNumber vData
- = HandshakeNegotiationResult r vNumber vData
- | HandshakeQueryResult (Map vNumber (Either Text vData))
- data RefuseReason vNumber
- = VersionMismatch [vNumber] [Int]
- | HandshakeDecodeError vNumber Text
- | Refused vNumber Text
- data Accept vData
- handshake_QUERY_SHUTDOWN_DELAY :: DiffTime
Documentation
runHandshakeClient :: (MonadAsync m, MonadFork m, MonadTimer m, MonadMask m, MonadThrow (STM m), Ord vNumber) => MuxBearer m -> connectionId -> HandshakeArguments connectionId vNumber vData m -> Versions vNumber vData application -> m (Either (HandshakeException vNumber) (HandshakeResult application vNumber vData)) Source #
Run client side of the Handshake
protocol
runHandshakeServer :: (MonadAsync m, MonadFork m, MonadTimer m, MonadMask m, MonadThrow (STM m), Ord vNumber) => MuxBearer m -> connectionId -> HandshakeArguments connectionId vNumber vData m -> Versions vNumber vData application -> m (Either (HandshakeException vNumber) (HandshakeResult application vNumber vData)) Source #
Run server side of the Handshake
protocol.
data HandshakeArguments connectionId vNumber vData (m :: Type -> Type) Source #
Common arguments for both Handshake
client & server.
HandshakeArguments | |
|
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 ...) , ... ]
Versions | |
|
data HandshakeException vNumber Source #
Wrapper around initiator and responder errors experienced by tryHandshake.
Instances
Show vNumber => Show (HandshakeException vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake showsPrec :: Int -> HandshakeException vNumber -> ShowS # show :: HandshakeException vNumber -> String # showList :: [HandshakeException vNumber] -> ShowS # |
data HandshakeProtocolError vNumber Source #
Extends handshake error
type, by client specific errors.RefuseReason
HandshakeError (RefuseReason vNumber) | |
NotRecognisedVersion vNumber | |
InvalidServerSelection vNumber Text | |
QueryNotSupported |
Instances
(Typeable vNumber, Show vNumber) => Exception (HandshakeProtocolError vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Type toException :: HandshakeProtocolError vNumber -> SomeException # fromException :: SomeException -> Maybe (HandshakeProtocolError vNumber) # displayException :: HandshakeProtocolError vNumber -> String # backtraceDesired :: HandshakeProtocolError vNumber -> Bool # | |
Show vNumber => Show (HandshakeProtocolError vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Type showsPrec :: Int -> HandshakeProtocolError vNumber -> ShowS # show :: HandshakeProtocolError vNumber -> String # showList :: [HandshakeProtocolError vNumber] -> ShowS # | |
Eq vNumber => Eq (HandshakeProtocolError vNumber) Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Type (==) :: HandshakeProtocolError vNumber -> HandshakeProtocolError vNumber -> Bool # (/=) :: HandshakeProtocolError vNumber -> HandshakeProtocolError vNumber -> Bool # |
data HandshakeResult r vNumber vData Source #
The result of a handshake.
HandshakeNegotiationResult r vNumber vData | |
HandshakeQueryResult (Map vNumber (Either Text vData)) |
data RefuseReason vNumber Source #
Reasons by which a server can refuse proposed version.
VersionMismatch [vNumber] [Int] | All of the prosed versions where not known to the server.
Since the server sends all versions that it can knows about, some of them
we might not be able to decode, so we include raw tags |
HandshakeDecodeError vNumber Text | The server failed to decode version parameters. |
Refused vNumber Text | The server refused to run the proposed version parameters |
Instances
A
like type which better explains its purpose.Maybe
handshake_QUERY_SHUTDOWN_DELAY :: DiffTime Source #
A 20s delay after query result was send back, before we close the connection. After that delay we close the connection.