Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- class (Networked m, Timed m, MonadRandomBytes m, MonadState DhtState m, Keyed m) => DhtNodeMonad m
- data RequestInfo = RequestInfo {}
- sendDhtPacket :: (DhtNodeMonad m, Binary payload) => NodeInfo -> PacketKind -> payload -> m ()
- sendRpcRequest :: (DhtNodeMonad m, Binary payload) => NodeInfo -> PacketKind -> payload -> m ()
- sendNodesRequest :: DhtNodeMonad m => RequestInfo -> m ()
- sendNodesResponse :: DhtNodeMonad m => NodeInfo -> RequestId -> [NodeInfo] -> m ()
- sendPingRequest :: DhtNodeMonad m => NodeInfo -> m ()
- sendPingResponse :: DhtNodeMonad m => NodeInfo -> RequestId -> m ()
- modifyM :: MonadState s m => (s -> m s) -> m ()
- zoom_ :: MonadState s' m => Lens' s' s -> StateT s m a -> m a
- initRandomSearches :: Int
- initDht :: (MonadRandomBytes m, Timed m) => m DhtState
- bootstrapNode :: DhtNodeMonad m => NodeInfo -> m ()
- randomRequestPeriod :: TimeDiff
- maxBootstrapTimes :: Int
- randomRequests :: DhtNodeMonad m => WriterT [RequestInfo] m ()
- checkPeriod :: TimeDiff
- maxChecks :: Int
- checkNodes :: forall m. DhtNodeMonad m => WriterT [RequestInfo] m ()
- doDHT :: DhtNodeMonad m => m ()
- requireNodesResponseWithin :: TimeDiff
- handleNodesResponse :: DhtNodeMonad m => NodeInfo -> RpcPacket NodesResponse -> m ()
- responseMaxNodes :: Int
- handleNodesRequest :: DhtNodeMonad m => NodeInfo -> RpcPacket NodesRequest -> m ()
- handlePingRequest :: DhtNodeMonad m => NodeInfo -> RpcPacket PingPacket -> m ()
- requirePingResponseWithin :: TimeDiff
- maxPendingTime :: TimeDiff
- checkPending :: DhtNodeMonad m => TimeDiff -> NodeInfo -> RequestId -> m Bool
- handlePingResponse :: DhtNodeMonad m => NodeInfo -> RpcPacket PingPacket -> m ()
- sendPingRequestIfAppropriate :: DhtNodeMonad m => NodeInfo -> m ()
- handleDhtRequestPacket :: DhtNodeMonad m => NodeInfo -> DhtRequestPacket -> m ()
- type NatPingPacket = ()
- handleNatPingPacket :: DhtNodeMonad m => NatPingPacket -> m ()
- type DhtPKPacket = ()
- handleDhtPKPacket :: DhtNodeMonad m => DhtPKPacket -> m ()
- type TestDhtNodeMonad = KeyedT (TimedT (RandT StdGen (StateT DhtState (NetworkLogged Identity))))
- runTestDhtNode :: ArbStdGen -> Timestamp -> DhtState -> TestDhtNodeMonad a -> (a, DhtState)
- evalTestDhtNode :: ArbStdGen -> Timestamp -> DhtState -> TestDhtNodeMonad a -> a
- execTestDhtNode :: ArbStdGen -> Timestamp -> DhtState -> TestDhtNodeMonad a -> DhtState
- initTestDhtState :: ArbStdGen -> Timestamp -> DhtState
- newtype ArbStdGen = ArbStdGen {}
Documentation
class (Networked m, Timed m, MonadRandomBytes m, MonadState DhtState m, Keyed m) => DhtNodeMonad m Source #
Instances
DhtNodeMonad TestDhtNodeMonad Source # | |
Defined in Network.Tox.DHT.Operation |
data RequestInfo Source #
Instances
Eq RequestInfo Source # | |
Defined in Network.Tox.DHT.Operation (==) :: RequestInfo -> RequestInfo -> Bool # (/=) :: RequestInfo -> RequestInfo -> Bool # | |
Read RequestInfo Source # | |
Defined in Network.Tox.DHT.Operation readsPrec :: Int -> ReadS RequestInfo # readList :: ReadS [RequestInfo] # readPrec :: ReadPrec RequestInfo # readListPrec :: ReadPrec [RequestInfo] # | |
Show RequestInfo Source # | |
Defined in Network.Tox.DHT.Operation showsPrec :: Int -> RequestInfo -> ShowS # show :: RequestInfo -> String # showList :: [RequestInfo] -> ShowS # |
sendDhtPacket :: (DhtNodeMonad m, Binary payload) => NodeInfo -> PacketKind -> payload -> m () Source #
sendRpcRequest :: (DhtNodeMonad m, Binary payload) => NodeInfo -> PacketKind -> payload -> m () Source #
sendNodesRequest :: DhtNodeMonad m => RequestInfo -> m () Source #
sendNodesResponse :: DhtNodeMonad m => NodeInfo -> RequestId -> [NodeInfo] -> m () Source #
sendPingRequest :: DhtNodeMonad m => NodeInfo -> m () Source #
sendPingResponse :: DhtNodeMonad m => NodeInfo -> RequestId -> m () Source #
modifyM :: MonadState s m => (s -> m s) -> m () Source #
zoom_ :: MonadState s' m => Lens' s' s -> StateT s m a -> m a Source #
adapted from michaelt's lens-simple: zoom_ is like zoom but for convenience returns an mtl style abstracted MonadState state, rather than a concrete StateT, recapturing a bit more of the abstractness of Control.Lens.zoom
bootstrapNode :: DhtNodeMonad m => NodeInfo -> m () Source #
randomRequests :: DhtNodeMonad m => WriterT [RequestInfo] m () Source #
checkNodes :: forall m. DhtNodeMonad m => WriterT [RequestInfo] m () Source #
doDHT :: DhtNodeMonad m => m () Source #
handleNodesResponse :: DhtNodeMonad m => NodeInfo -> RpcPacket NodesResponse -> m () Source #
handleNodesRequest :: DhtNodeMonad m => NodeInfo -> RpcPacket NodesRequest -> m () Source #
handlePingRequest :: DhtNodeMonad m => NodeInfo -> RpcPacket PingPacket -> m () Source #
checkPending :: DhtNodeMonad m => TimeDiff -> NodeInfo -> RequestId -> m Bool Source #
handlePingResponse :: DhtNodeMonad m => NodeInfo -> RpcPacket PingPacket -> m () Source #
sendPingRequestIfAppropriate :: DhtNodeMonad m => NodeInfo -> m () Source #
handleDhtRequestPacket :: DhtNodeMonad m => NodeInfo -> DhtRequestPacket -> m () Source #
type NatPingPacket = () Source #
TODO
handleNatPingPacket :: DhtNodeMonad m => NatPingPacket -> m () Source #
type DhtPKPacket = () Source #
TODO
handleDhtPKPacket :: DhtNodeMonad m => DhtPKPacket -> m () Source #
type TestDhtNodeMonad = KeyedT (TimedT (RandT StdGen (StateT DhtState (NetworkLogged Identity)))) Source #
runTestDhtNode :: ArbStdGen -> Timestamp -> DhtState -> TestDhtNodeMonad a -> (a, DhtState) Source #
evalTestDhtNode :: ArbStdGen -> Timestamp -> DhtState -> TestDhtNodeMonad a -> a Source #
execTestDhtNode :: ArbStdGen -> Timestamp -> DhtState -> TestDhtNodeMonad a -> DhtState Source #
wrap StdGen so the Arbitrary instance isn't an orphan