Election.ice
Go to the documentation of this file.
1 // **********************************************************************
2 //
3 // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
4 //
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
7 //
8 // **********************************************************************
9 
10 #pragma once
11 
12 [["ice-prefix", "cpp:header-ext:h"]]
13 
14 #include <Ice/Identity.ice>
15 #include <Ice/BuiltinSequences.ice>
17 #include <IceStorm/LLURecord.ice>
18 
19 module IceStormElection
20 {
21 
24 {
29 }
30 
32 sequence<TopicContent> TopicContentSeq;
33 
36 {
38  string reason;
39 }
40 
42 interface ReplicaObserver
43 {
56  void init(LogUpdate llu, TopicContentSeq content)
58 
71  void createTopic(LogUpdate llu, string name)
73 
86  void destroyTopic(LogUpdate llu, string name)
88 
103  void addSubscriber(LogUpdate llu, string topic, IceStorm::SubscriberRecord record)
105 
120  void removeSubscriber(LogUpdate llu, string topic, Ice::IdentitySeq subscribers)
122 }
123 
126 {
135  void getContent(out LogUpdate llu, out TopicContentSeq content);
136 }
137 
140 {
149 }
150 
152 interface Node;
153 
155 struct NodeInfo
156 {
158  int id;
160  Node* n;
161 }
162 
164 sequence<NodeInfo> NodeInfoSeq;
165 
167 struct GroupInfo
168 {
170  int id;
173 }
175 sequence<GroupInfo> GroupInfoSeq;
176 
177 struct QueryInfo
178 {
180  int id;
181 
183  int coord;
184 
186  string group;
187 
189  Object* replica;
190 
193 
196 
198  int max;
199 }
200 
202 interface Node
203 {
214  void invitation(int j, string gn);
215 
232  void ready(int j, string gn, Object* coordinator, int max, long generation);
233 
254  void accept(int j, string gn, Ice::IntSeq forwardedInvites, Object* observer, LogUpdate llu, int max);
255 
262  ["cpp:const"] idempotent bool areYouCoordinator();
263 
276  ["cpp:const"] idempotent bool areYouThere(string gn, int j);
277 
285  ["cpp:const"] idempotent Object* sync();
286 
295  ["cpp:const"] idempotent NodeInfoSeq nodes();
296 
304  ["cpp:const"] idempotent QueryInfo query();
305 }
306 
307 }
IceStorm::SubscriberRecordSeq
::std::vector< ::IceStorm::SubscriberRecord > SubscriberRecordSeq
Definition: SubscriberRecord.h:225
IceStormElection::TopicManagerSync
Interface used to sync topics.
Definition: Election.ice:125
IceStormElection::QueryInfo::coord
int coord
The nodes coordinator.
Definition: Election.ice:183
IceStormElection::GroupInfo::llu
LogUpdate llu
The last known log update for this node.
Definition: Election.ice:172
IceStormElection::QueryInfo
Definition: Election.ice:177
IceStormElection::QueryInfo::up
GroupInfoSeq up
The sequence of nodes in this nodes group.
Definition: Election.ice:195
IceStormElection::LogUpdate
A struct used for marking the last log update.
Definition: LLURecord.h:100
IceStormElection::NodeStateElection
@ NodeStateElection
The node is electing a leader.
Definition: Election.ice:144
IceStormElection::ReplicaObserver
The replica observer.
Definition: Election.ice:42
IceStormElection::NodeInfo::n
Node * n
The node proxy.
Definition: Election.ice:160
IceStormElection::QueryInfo::id
int id
The node id.
Definition: Election.ice:180
IceStormElection::ObserverInconsistencyException
Thrown if an observer detects an inconsistency.
Definition: Election.ice:35
IceStorm::SubscriberRecord
Used to store persistent information for persistent subscribers.
Definition: SubscriberRecord.h:214
IceStormElection::ObserverInconsistencyException::reason
string reason
The reason for the inconsistency.
Definition: Election.ice:38
IceStormElection::TopicContentSeq
::std::vector< ::IceStormElection::TopicContent > TopicContentSeq
A sequence of topic content.
Definition: Election.h:819
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
IceStormElection::TopicContent::id
Ice::Identity id
The topic identity.
Definition: Election.ice:26
IceStormElection::NodeStateInactive
@ NodeStateInactive
The node is inactive and awaiting an election.
Definition: Election.ice:142
IceStormElection::TopicContent
The contents of topic.
Definition: Election.ice:23
IceStormElection::Node
A replica node.
Definition: Election.ice:202
IceStormElection::QueryInfo::max
int max
The highest priority node that this node has seen.
Definition: Election.ice:198
IceStormElection::NodeState
NodeState
The node state.
Definition: Election.ice:139
IceStormElection
Definition: DBTypes.ice:17
IceStormElection::GroupInfoSeq
::std::vector< ::IceStormElection::GroupInfo > GroupInfoSeq
A sequence of group info.
Definition: Election.h:924
IceStormElection::QueryInfo::group
string group
The nodes group name.
Definition: Election.ice:186
IceStormElection::GroupInfo
The group info.
Definition: Election.ice:167
IceStormElection::NodeInfo
All nodes in the replication group.
Definition: Election.ice:155
IceStormElection::NodeStateReorganization
@ NodeStateReorganization
The replica group is reorganizing.
Definition: Election.ice:146
max
T max(T t1, T t2)
Definition: gdiam.h:48
IceStormElection::NodeStateNormal
@ NodeStateNormal
The replica group is active & replicating.
Definition: Election.ice:148
LLURecord.ice
IceStormElection::NodeInfo::id
int id
The identity of the node.
Definition: Election.ice:158
SubscriberRecord.ice
IceStormElection::QueryInfo::state
NodeState state
The node state.
Definition: Election.ice:192
IceStormElection::NodeInfoSeq
::std::vector< ::IceStormElection::NodeInfo > NodeInfoSeq
A sequence of node info.
Definition: Election.h:857
IceStormElection::GroupInfo::id
int id
The identity of the node.
Definition: Election.ice:170
IceStormElection::QueryInfo::replica
Object * replica
The replica the node is managing.
Definition: Election.ice:189
IceStormElection::TopicContent::records
IceStorm::SubscriberRecordSeq records
The topic subscribers.
Definition: Election.ice:28