neilconway / overlog-paxos
A clean implementation of the Paxos consensus protocol in Overlog, a language for distributed computing.
Clone this repository (size: 4.5 MB): HTTPS / SSH
$ hg clone http://bitbucket.org/neilconway/overlog-paxos/
Changed (Δ525 bytes):
raw changeset »
src/olg/glue.olg (28 lines added, 0 lines removed)
Up to file-list src/olg/glue.olg:
1 |
program paxos_gluer; |
|
2 |
||
3 |
import jol.core.Runtime; |
|
4 |
||
5 |
/* glue for BFS */ |
|
6 |
||
7 |
watch(paxos_global::decreeRequest, ae); |
|
8 |
||
9 |
public |
|
10 |
leader::start(X) :- |
|
11 |
paxos_global::id(X); |
|
12 |
||
13 |
||
14 |
public |
|
15 |
paxos_stub::start(X) :- |
|
16 |
paxos_global::id(X); |
|
17 |
||
18 |
||
19 |
watch(paxos_propose::q, ae); |
|
20 |
||
21 |
public |
|
22 |
paxos_propose::q(Master, Decree, From, Id) :- |
|
23 |
paxos_global::decreeRequest(Master, Decree, From), |
|
24 |
Id := Runtime.idgen(); |
|
25 |
||
26 |
public |
|
27 |
paxos_global::requestStatus(Master, Client, Decree, Instance, "passed") :- |
|
28 |
paxos_stub::global_history(Master, Instance, Client, Decree); |
