Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data PeerSharingController peer m
- newtype PeerSharingRegistry peer m = PeerSharingRegistry {
- getPeerSharingRegistry ∷ StrictTVar m (Map peer (PeerSharingController peer m))
- newPeerSharingRegistry ∷ (MonadSTM m, Ord peer) ⇒ m (PeerSharingRegistry peer m)
- bracketPeerSharingClient ∷ (Ord peer, MonadSTM m, MonadThrow m) ⇒ PeerSharingRegistry peer m → peer → (PeerSharingController peer m → m a) → m a
- peerSharingClient ∷ (Alternative (STM m), MonadMVar m, MonadSTM m, MonadThrow m) ⇒ ControlMessageSTM m → PeerSharingController peer m → m (PeerSharingClient peer m ())
- peerSharingServer ∷ (MonadSTM m, MonadMonotonicTime m, Hashable peer, RandomGen s) ⇒ PeerSharingAPI peer s m → PeerSharingServer peer m
- requestPeers ∷ (MonadMVar m, MonadSTM m) ⇒ PeerSharingController peer m → PeerSharingAmount → m [peer]
- data PeerSharingAPI addr s m = PeerSharingAPI {}
- newPeerSharingAPI ∷ MonadSTM m ⇒ StrictTVar m (PublicPeerSelectionState addr) → s → DiffTime → PeerSharingAmount → m (PeerSharingAPI addr s m)
- ps_POLICY_PEER_SHARE_STICKY_TIME ∷ DiffTime
- ps_POLICY_PEER_SHARE_MAX_PEERS ∷ PeerSharingAmount
- data PeerSharingResult peerAddress
- = PeerSharingResult [peerAddress]
- | PeerSharingNotRegisteredYet
Documentation
data PeerSharingController peer m Source #
Request and Result queue for the peer sharing client implementation.
Although Peer Sharing is a request-response protocol we can not run it as one, i.e. starting and terminating the protocol on demand since protocol termination as a different semantics. We have to keep the client and server protocol sides running and only issue the requests on demand.
A workaround to this is to implement the client side with the help of a
PeerSharingController which contains two queues: request and result.
The client side will be waiting to receive a PeerSharingAmount
from the
request queue and as soon as it gets something it will send a
SendMsgShareRequest
and wait for a response before writing it to the
result queue.
newtype PeerSharingRegistry peer m Source #
Peer Sharing Registry is a registry that stores a PeerSharingController
for every peer that we connect to.
bracketPeerSharingClient
should be used.
PeerSharingRegistry | |
|
newPeerSharingRegistry ∷ (MonadSTM m, Ord peer) ⇒ m (PeerSharingRegistry peer m) Source #
bracketPeerSharingClient ∷ (Ord peer, MonadSTM m, MonadThrow m) ⇒ PeerSharingRegistry peer m → peer → (PeerSharingController peer m → m a) → m a Source #
peerSharingClient ∷ (Alternative (STM m), MonadMVar m, MonadSTM m, MonadThrow m) ⇒ ControlMessageSTM m → PeerSharingController peer m → m (PeerSharingClient peer m ()) Source #
peerSharingServer ∷ (MonadSTM m, MonadMonotonicTime m, Hashable peer, RandomGen s) ⇒ PeerSharingAPI peer s m → PeerSharingServer peer m Source #
requestPeers ∷ (MonadMVar m, MonadSTM m) ⇒ PeerSharingController peer m → PeerSharingAmount → m [peer] Source #
data PeerSharingAPI addr s m Source #
PeerSharingAPI needed to compute the peers to be shared.
PeerSharingAPI | |
|
newPeerSharingAPI ∷ MonadSTM m ⇒ StrictTVar m (PublicPeerSelectionState addr) → s → DiffTime → PeerSharingAmount → m (PeerSharingAPI addr s m) Source #
Create a new PeerSharingAPI
Constants
ps_POLICY_PEER_SHARE_STICKY_TIME ∷ DiffTime Source #
Amount of time between changes to the salt used to pick peers to gossip about.
ps_POLICY_PEER_SHARE_MAX_PEERS ∷ PeerSharingAmount Source #
Maximum number of peers to respond with in a single request
Re-exports
data PeerSharingResult peerAddress Source #
PeerSharing Result type.
We need a constructor for the case when the Governor wins the race versus the Mux (when initialising the peer sharing miniprotocol). This leads the Governor to lookup a peer that hasn't been registered yet.
PeerSharingResult [peerAddress] | |
PeerSharingNotRegisteredYet |
Instances
Show peerAddress ⇒ Show (PeerSharingResult peerAddress) | |
Defined in Ouroboros.Network.Protocol.PeerSharing.Type showsPrec ∷ Int → PeerSharingResult peerAddress → ShowS # show ∷ PeerSharingResult peerAddress → String # showList ∷ [PeerSharingResult peerAddress] → ShowS # | |
Eq peerAddress ⇒ Eq (PeerSharingResult peerAddress) | |
Defined in Ouroboros.Network.Protocol.PeerSharing.Type (==) ∷ PeerSharingResult peerAddress → PeerSharingResult peerAddress → Bool # (/=) ∷ PeerSharingResult peerAddress → PeerSharingResult peerAddress → Bool # |