relay
Safe HaskellNone
LanguageGHC2024

Relay.Reliable.Inbox

Description

 
Synopsis

Documentation

newtype Inbox a Source #

The receive half of one reliable session: the dual of Outbox.

It wraps a ReceiverHalf, which tracks the delivery frontier: the highest sequence number released in order so far. Every sequence number up to and including the frontier has been delivered to the application; nothing above it has (out-of-order arrivals wait in the reorder buffer until the gap fills). Inbox adds the cumulative ack value derived from that frontier.

Constructors

Inbox 

Fields

Instances

Instances details
Eq a => Eq (Inbox a) Source # 
Instance details

Defined in Relay.Reliable.Inbox

Methods

(==) :: Inbox a -> Inbox a -> Bool #

(/=) :: Inbox a -> Inbox a -> Bool #

Show a => Show (Inbox a) Source # 
Instance details

Defined in Relay.Reliable.Inbox

Methods

showsPrec :: Int -> Inbox a -> ShowS #

show :: Inbox a -> String #

showList :: [Inbox a] -> ShowS #

emptyInbox :: Inbox a Source #

Initial inbox state: nothing received, expecting sequence 1.

recv :: Frame a -> Inbox a -> (Inbox a, [a]) Source #

Accept one arriving frame, delegating dedup, reorder buffering, and in-order release to receive. Returns the updated inbox and any newly deliverable payloads.

ackFrontier :: Inbox a -> Maybe Nat Source #

The cumulative acknowledgement value: the delivery frontier expressed as an ack. Nothing before sequence 1 has arrived (one-based convention), otherwise Just (expected - 1) — the highest sequence number delivered in order so far.