Skip to content

Instantly share code, notes, and snippets.

View Vanlightly's full-sized avatar

Jack Vanlightly Vanlightly

View GitHub Profile
@Vanlightly
Vanlightly / two_counters.tla
Created June 3, 2021 08:23
Example TLA+ specification
---------------------------- MODULE TwoCounters ----------------------------
EXTENDS Integers
CONSTANT C, Limit
VARIABLES counter
Init ==
counter = [c \in C |-> 0]
Next ==
\* MV CONSTANT declarations
CONSTANTS
a1 = a1
a2 = a2
a3 = a3
a4 = a4
a5 = a5
a6 = a6
a7 = a7
a8 = a8
------------------- MODULE rabbit_leaderless_rebalancing -------------------
EXTENDS TLC, Sequences, Integers, FiniteSets, Naturals
CONSTANTS Q, \* set of queues, e.g. { q1, q2, q3, q4, q5 }
A \* set of apps, e.g. { a1, a2, a3 }
(*
Models an algorithm that balances the consumption of group of Q queues over a group of
A applications, using the Single Active Consumer (SAC) feature of RabbitMQ.
------------------- MODULE rabbit_leaderless_rebalancing -------------------
EXTENDS TLC, Sequences, Integers, FiniteSets, Naturals
CONSTANTS Q, \* set of queues, e.g. { q1, q2, q3, q4, q5 }
A \* set of apps, e.g. { a1, a2, a3 }
(*
Models an algorithm that balances the consumption of group of Q queues over a group of
A applications, using the Single Active Consumer (SAC) feature of RabbitMQ.
@Vanlightly
Vanlightly / rabbit_leaderless_rebalancing.tla
Last active July 22, 2020 22:03
An algorithm for coooperating RabbitMQ clients to balance consumption over a group of Sing-Active-Consumer queues
------------------- MODULE rabbit_leaderless_rebalancing -------------------
EXTENDS TLC, Sequences, Integers, FiniteSets, Naturals
CONSTANTS Q, \* set of queues, e.g. { q1, q2, q3, q4, q5 }
A \* set of apps, e.g. { a1, a2, a3 }
(*
Models an algorithm that balances the consumption of group of Q queues over a group of
A applications, using the Single Active Consumer (SAC) feature of RabbitMQ.