-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLivenessClientsDone.p
More file actions
60 lines (52 loc) · 1.83 KB
/
LivenessClientsDone.p
File metadata and controls
60 lines (52 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
spec LivenessClientsDone observes eClientPutRequest, eClientGetRequest, eClientFinishedMonitor {
var activeClients: set[Client];
var finishedClients: set[Client];
start state Init {
entry {
activeClients = default(set[Client]);
finishedClients = default(set[Client]);
goto AllClientsDone;
}
}
hot state ClientsActive {
on eClientFinishedMonitor do (c: Client) {
finishedClients += (c);
if (finishedClients == activeClients) {
goto AllClientsDone;
}
}
// on eClientRequest do (payload: tClientRequest) {
// if (payload.client == payload.sender) {
// activeClients += (payload.client);
// }
// }
on eClientPutRequest do (payload: tClientPutRequest) {
if (payload.client == payload.sender) {
activeClients += (payload.client);
}
}
on eClientGetRequest do (payload: tClientGetRequest) {
if (payload.client == payload.sender) {
activeClients += (payload.client);
}
}
}
cold state AllClientsDone {
on eClientPutRequest do (payload: tClientPutRequest) {
if (payload.client == payload.sender) {
activeClients += (payload.client);
goto ClientsActive;
}
}
on eClientGetRequest do (payload: tClientGetRequest) {
if (payload.client == payload.sender) {
activeClients += (payload.client);
goto ClientsActive;
}
}
on eClientFinishedMonitor do (c: Client) {
print format("Problematic: {0}", c);
assert false, "Received a client finished event after all clients are done.";
}
}
}