Skip to content

shayne-fletcher/relay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

relay logo

relay

executable models of message-delivery guarantees

haskell ci docs

relay is a small Haskell library of message-delivery guarantees. Each guarantee is a little algebra of two complementary halves — a send half and a receive half, with no shared runtime object — kept close to its laws, and then run end-to-end through a real concurrent test harness.

Guarantees

  • Ordered delivery — in-order release over a link that reorders but never loses. The sender stamps sequence numbers; the receiver buffers out-of-order arrivals and releases in order. → article/ordered-delivery.md
  • Reliable delivery — exactly-once, in-order release over a link that drops frames, via cumulative acks and retransmission. The closed loop the ordered model leaves open. → article/reliable-delivery.md

Modules

Relay.Session          frames, sessions, sequence numbers (shared)
Relay.SenderHalf       ordered: sequence assignment
Relay.ReceiverHalf     ordered: in-order release + reorder buffer
Relay.Buffer           ordered: multi-session receiver

Relay.Reliable.Outbox    reliable: send half (in-flight buffer, cumulative ack)
Relay.Reliable.Inbox     reliable: receive half (frontier + ack)
Relay.Reliable.Response  reliable: the reverse-channel ack type

The reliable layer reuses the ordered vocabulary unchanged — the same Frame, and ReceiverHalf as the delivery frontier.

Approach

Each guarantee is modelled twice over:

  • Pure laws — the local invariants of each half, as QuickCheck properties (sequence assignment, cumulative ack, dedup, the frontier invariant, …).
  • Concurrent check — the end-to-end guarantee that no half can observe locally, run through live sender/receiver threads over a channel that reorders (ordered) or drops (reliable).

Building

cabal build all
cabal test                                   # the whole suite
cabal test --test-options="--timeout 30s"    # guard the concurrent tests

Articles

About

ordered message delivery

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors