Revision bae57600 include/ZoneServer.h
include/ZoneServer.h | ||
---|---|---|
28 | 28 |
class ZoneServer : public ExtendedAttribute |
29 | 29 |
{ |
30 | 30 |
public: |
31 |
|
|
32 |
enum State { |
|
33 |
OFFLINE = 0, |
|
34 |
CANDIDATE = 1, |
|
35 |
FOLLOWER = 2, |
|
36 |
LEADER = 3 |
|
37 |
}; |
|
38 |
|
|
31 | 39 |
ZoneServer(VectorAttribute *va, int id):ExtendedAttribute(va, id){}; |
32 | 40 |
|
33 | 41 |
virtual ~ZoneServer(){}; |
... | ... | |
56 | 64 |
return 0; |
57 | 65 |
} |
58 | 66 |
|
67 |
/** |
|
68 |
* @return the ID of the server |
|
69 |
*/ |
|
59 | 70 |
int get_id() const |
60 | 71 |
{ |
61 | 72 |
return ExtendedAttribute::get_id(); |
62 | 73 |
} |
63 | 74 |
|
64 |
private: |
|
75 |
/** |
|
76 |
* Initialized follower data |
|
77 |
* @param last log index |
|
78 |
*/ |
|
79 |
void init_follower(unsigned int last) |
|
80 |
{ |
|
81 |
next = last + 1; |
|
82 |
match = 0; |
|
83 |
} |
|
65 | 84 |
|
85 |
private: |
|
86 |
//-------------------------------------------------------------------------- |
|
87 |
// Volatile log index variables |
|
88 |
// - commit, highest log known to be commited |
|
89 |
// - applied, highest log applied to DB |
|
90 |
// |
|
91 |
//---------------------------- LEADER VARIABLES ---------------------------- |
|
92 |
// |
|
93 |
// - next, next log to send to this server |
|
94 |
// - match, highest log replicated in this server |
|
95 |
// ------------------------------------------------------------------------- |
|
96 |
unsigned int commit; |
|
97 |
|
|
98 |
unsigned int applied; |
|
99 |
|
|
100 |
unsigned int next; |
|
101 |
|
|
102 |
unsigned int match; |
|
66 | 103 |
}; |
67 | 104 |
|
68 | 105 |
|
Also available in: Unified diff