ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Leios.NotifyLog

Description

What the node relays to its downstream peers over LeiosNotify.

The node keeps one log of notifications, in the order it appended them, and every LeiosNotify server reads that log through its own NotifyCursor. So a notification is stored once however many peers it goes to, and a peer that requests slowly merely lags behind in the log, rather than piling up a queue of its own.

Whoever appends a notification says until when it is worth relaying; the pruner drops it then, and the log does not take one it was pruned past already. So the node relays none longer than notifyLogPruneCadence after that. A peer that connects late starts at the log's oldest notification, so it still receives everything worth relaying, and a notification is never worth relaying longer than the announcement it is about, so a peer always receives the announcement first. A cursor that falls behind pruning merely skips what was pruned.

Synopsis

Documentation

data Notification blk Source #

A notification the node relays.

Instances

Instances details
Generic (Notification blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Leios.NotifyLog

Associated Types

type Rep (Notification blk) 
Instance details

Defined in Ouroboros.Consensus.Leios.NotifyLog

type Rep (Notification blk) = D1 ('MetaData "Notification" "Ouroboros.Consensus.Leios.NotifyLog" "ouroboros-consensus-5.0.0.0-inplace" 'False) (C1 ('MetaCons "NotifyAnnouncement" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (AnnouncingHeader blk))) :+: C1 ('MetaCons "NotifyVote" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LeiosVote)))

Methods

from ∷ Notification blk → Rep (Notification blk) x #

to ∷ Rep (Notification blk) x → Notification blk #

NoThunks (Header blk) ⇒ NoThunks (Notification blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Leios.NotifyLog

type Rep (Notification blk) Source # 
Instance details

Defined in Ouroboros.Consensus.Leios.NotifyLog

type Rep (Notification blk) = D1 ('MetaData "Notification" "Ouroboros.Consensus.Leios.NotifyLog" "ouroboros-consensus-5.0.0.0-inplace" 'False) (C1 ('MetaCons "NotifyAnnouncement" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (AnnouncingHeader blk))) :+: C1 ('MetaCons "NotifyVote" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LeiosVote)))

data NotifyLog (m ∷ Type → Type) blk Source #

The node's log of notifications to relay.

appendNotifyLog ∷ ∀ (m ∷ Type → Type) blk. IOLike m ⇒ NotifyLog m blk → Notification blk → RelativeTime → STM m () Source #

Append a notification worth relaying until the given time, unless the log was pruned past it already.

After that time, the notification is of no use to a downstream peer: a vote's deadline, or when an announcement is too old to relay. Either leaves a grace, for transmission and queueing, before the peer would reject it.

newNotifyLog ∷ (IOLike m, NoThunks (Header blk)) ⇒ m (NotifyLog m blk) Source #

nextNotifyLog ∷ ∀ (m ∷ Type → Type) blk. IOLike m ⇒ NotifyLog m blk → NotifyCursor → STM m (Notification blk, NotifyCursor) Source #

The first notification at or after the cursor, and the cursor just past it.

Retries until there is such a notification.

notifyLogPruneCadence ∷ NominalDiffTime Source #

How often the log is pruned, so how long after it stops being worth relaying the node may still relay a notification. It must stay far below the grace a downstream peer gives before it rejects one.

notifyLogPruner ∷ IOLike m ⇒ SystemTime m → NotifyLog m blk → m Void Source #

Prune the log every notifyLogPruneCadence.

notifyLogStart ∷ NotifyCursor Source #

Where a downstream peer starts reading: before every notification, including the ones already pruned.

pruneNotifyLog ∷ ∀ (m ∷ Type → Type) blk. IOLike m ⇒ NotifyLog m blk → RelativeTime → STM m () Source #

Prune every notification no longer worth relaying at the given time.

Leaves the notifications untouched if there is none, so as not to wake every server reading them.