Newer
Older
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
61
62
63
64
65
66
67
68
package refit.replica.order;
import refit.config.REFITConfig;
import refit.replica.REFITReplicaGroups;
public abstract class REFITOrderProtocol {
protected static final boolean[] NO_REPLICA = new boolean[REFITConfig.TOTAL_NR_OF_REPLICAS];
protected static final boolean[] ALL_REPLICAS = REFITReplicaGroups.getAllReplicas();
// ####################
// # ABSTRACT METHODS #
// ####################
public abstract REFITOrderProtocolInstance createInstance(REFITOrderStageSlot slot);
public abstract REFITOrderProtocolTransitionInstance createTransitionInstance(REFITOrderStageSlot slot);
// ###################
// # DEFAULT METHODS #
// ###################
public boolean[] getActiveOrderRecipients(int groupID) {
// currently active order replicas
return REFITOrderGroups.getGroupByID(groupID);
}
public boolean[] getAllOrderRecipients(int groupID) {
// full set of order replicas
return REFITOrderGroups.getGroupByID(groupID);
}
public boolean[] getUpdateRecipients() {
return NO_REPLICA;
}
public boolean[] getCheckpointRecipients() {
return ALL_REPLICAS;
}
public boolean useLightweightCheckpoints() {
return false;
}
// ##################
// # HELPER METHODS #
// ##################
public boolean hasCheckpointRecipients() {
boolean[] recipients = getCheckpointRecipients();
for (boolean recipient : recipients) {
if (recipient) return true;
}
return false;
}
public boolean hasUpdateRecipients() {
boolean[] recipients = getUpdateRecipients();
for (boolean recipient : recipients) {
if (recipient) return true;
}
return false;
}
}