Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / ubik / ubik_int.xg
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 prefix S
11
12 struct BDesc {
13 afs_int32 host;
14 short portal;
15 afs_int32 session;
16 };
17
18 struct ubik_version {
19 afs_int32 epoch;
20 afs_int32 counter;
21 };
22
23 struct ubik_tid {
24 afs_int32 epoch;
25 afs_int32 counter;
26 };
27
28 const UBIK_MAX_INTERFACE_ADDR = 256; /* max interfaces per server */
29
30 struct ubik_debug {
31 /* variables from basic voting module */
32 afs_int32 now; /* time of day now */
33 afs_int32 lastYesTime; /* last time we sent last yes vote */
34 afs_int32 lastYesHost; /* host to which we sent last yes vote */
35 afs_int32 lastYesState; /* did last yes host claim to be sync site */
36 afs_int32 lastYesClaim; /* time last vote started; claim sync site until .+SMALLTIME */
37 afs_int32 lowestHost; /* host we'd prefer to vote for */
38 afs_int32 lowestTime; /* time we last chose lowestHost */
39 afs_int32 syncHost; /* sync site we've heard from last (even if we didn't vote) */
40 afs_int32 syncTime; /* time of above */
41 struct ubik_version syncVersion; /* sync site's claimed db version */
42 struct ubik_tid syncTid; /* sync site's claimed tid */
43
44 /* variables from beacon module */
45 afs_int32 amSyncSite; /* do I think I'm the sync site */
46 afs_int32 syncSiteUntil; /* when does my sync site mandate expire? */
47 afs_int32 nServers; /* number of servers participating in vote */
48
49 /* variables from disk module */
50 afs_int32 lockedPages; /* count of read-locked pages */
51 afs_int32 writeLockedPages; /* count of write-locked pages */
52 struct ubik_version localVersion;
53 afs_int32 activeWrite; /* is there an active write transaction with this as sync site */
54 afs_int32 tidCounter; /* tid counter field from dbase, or 0 if no write trans. */
55
56 /* variables from the lock module */
57 afs_int32 anyReadLocks; /* are any read locks held on the current trans, if any */
58 afs_int32 anyWriteLocks; /* are any write locks held on the current trans, if any */
59
60 /* variables from the recovery module */
61 afs_int32 recoveryState; /* recovery state flags */
62
63 /* variables from the remote module */
64 afs_int32 currentTrans; /* is there a current transaction on this server */
65 afs_int32 writeTrans; /* is it a write transaction */
66
67 /* variables from the ubik module */
68 afs_int32 epochTime; /* time this server started */
69 /* all network interface addresses of host in host order*/
70 afs_int32 interfaceAddr[UBIK_MAX_INTERFACE_ADDR];
71 };
72
73 /* data from the per-server structure */
74 struct ubik_sdebug {
75 afs_int32 addr; /* primary address in *host* order */
76 afs_int32 lastVoteTime; /* time last vote received */
77 afs_int32 lastBeaconSent; /* time last beacon sent */
78 afs_int32 lastVote; /* was last vote yes? */
79 struct ubik_version remoteVersion;
80 afs_int32 currentDB; /* is current DB up to date? */
81 afs_int32 beaconSinceDown; /* beacon sent since last noticed up? */
82 afs_int32 up; /* is site up */
83 afs_int32 altAddr[255]; /*alternate addresses:host byte */
84 /*this is actually UBIK_MAX_INTERFACE_ADDR-1*/
85 };
86
87 struct ubik_debug_old {
88 /* variables from basic voting module */
89 afs_int32 now; /* time of day now */
90 afs_int32 lastYesTime; /* last time we sent last yes vote */
91 afs_int32 lastYesHost; /* host to which we sent last yes vote */
92 afs_int32 lastYesState; /* did last yes host claim to be sync site */
93 afs_int32 lastYesClaim; /* time last vote started; claim sync site until .+SMALLTIME */
94 afs_int32 lowestHost; /* host we'd prefer to vote for */
95 afs_int32 lowestTime; /* time we last chose lowestHost */
96 afs_int32 syncHost; /* sync site we've heard from last (even if we didn't vote) */
97 afs_int32 syncTime; /* time of above */
98 struct ubik_version syncVersion; /* sync site's claimed db version */
99 struct ubik_tid syncTid; /* sync site's claimed tid */
100
101 /* variables from beacon module */
102 afs_int32 amSyncSite; /* do I think I'm the sync site */
103 afs_int32 syncSiteUntil; /* when does my sync site mandate expire? */
104 afs_int32 nServers; /* number of servers participating in vote */
105
106 /* variables from disk module */
107 afs_int32 lockedPages; /* count of read-locked pages */
108 afs_int32 writeLockedPages; /* count of write-locked pages */
109 struct ubik_version localVersion;
110 afs_int32 activeWrite; /* is there an active write transaction with this as sync site */
111 afs_int32 tidCounter; /* tid counter field from dbase, or 0 if no write trans. */
112
113 /* variables from the lock module */
114 afs_int32 anyReadLocks; /* are any read locks held on the current trans, if any */
115 afs_int32 anyWriteLocks; /* are any write locks held on the current trans, if any */
116
117 /* variables from the recovery module */
118 afs_int32 recoveryState; /* recovery state flags */
119
120 /* variables from the remote module */
121 afs_int32 currentTrans; /* is there a current transaction on this server */
122 afs_int32 writeTrans; /* is it a write transaction */
123
124 /* variables from the ubik module */
125 afs_int32 epochTime; /* time this server started */
126 };
127
128 /* data from the per-server structure */
129 struct ubik_sdebug_old {
130 afs_int32 addr; /* address in *host* order */
131 afs_int32 lastVoteTime; /* time last vote received */
132 afs_int32 lastBeaconSent; /* time last beacon sent */
133 afs_int32 lastVote; /* was last vote yes? */
134 struct ubik_version remoteVersion;
135 afs_int32 currentDB; /* is current DB up to date? */
136 afs_int32 beaconSinceDown; /* beacon sent since last noticed up? */
137 afs_int32 up; /* is site up */
138 };
139 /* list of network interface addresses in hostbyte order */
140 struct UbikInterfaceAddr {
141 afs_int32 hostAddr[UBIK_MAX_INTERFACE_ADDR];
142 } ;
143
144
145 const BULK_ERROR = 1;
146
147 typedef opaque bulkdata<20000>;
148
149 const IOVEC_MAXBUF = 65536; /* 64*1K */
150 const IOVEC_MAXWRT = 64; /* max number of bulk writes allowed */
151 typedef opaque iovec_buf<IOVEC_MAXBUF>;
152 struct ubik_iovec {
153 afs_int32 file; /* File to be written */
154 afs_int32 position; /* File position */
155 afs_int32 length; /* number of bytes to write */
156 };
157 typedef struct ubik_iovec iovec_wrt<IOVEC_MAXWRT>;
158
159 /* This package handles call sent to other voters to synchronize things in ubik. */
160 package VOTE_
161 statindex 11
162
163 /* Opcodes for the Vote package interface calls */
164 #define VOTE_BEACON 10000
165 #define VOTE_DEBUG_OLD 10001
166 #define VOTE_SDEBUG_OLD 10002
167 #define VOTE_GETSYNCSITE 10003
168 #define VOTE_DEBUG 10004
169 #define VOTE_SDEBUG 10005
170 #define VOTE_XDEBUG 10006
171 #define VOTE_XSDEBUG 10007
172
173 /* Vote package interface calls */
174 Beacon (IN afs_int32 state,
175 afs_int32 voteStart,
176 ubik_version *Version,
177 ubik_tid *tid) multi = VOTE_BEACON;
178
179 DebugOld (OUT ubik_debug_old *db) = VOTE_DEBUG_OLD;
180
181 SDebugOld (IN afs_int32 which,
182 OUT ubik_sdebug_old *db) = VOTE_SDEBUG_OLD;
183
184 GetSyncSite (IN afs_int32 *site) = VOTE_GETSYNCSITE;
185
186 Debug (OUT ubik_debug *db) = VOTE_DEBUG;
187
188 SDebug (IN afs_int32 which,
189 OUT ubik_sdebug *db) = VOTE_SDEBUG;
190
191 XDebug (OUT ubik_debug *db,
192 OUT afs_int32 *isClone) = VOTE_XDEBUG;
193
194 XSDebug (IN afs_int32 which,
195 OUT ubik_sdebug *db,
196 OUT afs_int32 *isClone) = VOTE_XSDEBUG;
197
198 /* This package handles calls used to pass writes, begins and ends to other servers */
199 package DISK_
200 statindex 12
201
202 /* Opcodes for the Disk package interface calls */
203 #define DISK_BEGIN 20000
204 #define DISK_COMMIT 20001
205 #define DISK_LOCK 20002
206 #define DISK_WRITE 20003
207 #define DISK_GETVERSION 20004
208 #define DISK_GETFILE 20005
209 #define DISK_SENDFILE 20006
210 #define DISK_ABORT 20007
211 #define DISK_RELEASELOCKS 20008
212 #define DISK_TRUNCATE 20009
213 #define DISK_PROBE 20010
214 #define DISK_WRITEV 20011
215 #define DISK_INTERFACEADDR 20012
216 #define DISK_SETVERSION 20013
217
218 /* Disk package interface calls - the order of
219 * these declarations is important.
220 */
221 Begin (IN ubik_tid *tid) = DISK_BEGIN;
222
223 Commit (IN ubik_tid *tid) = DISK_COMMIT;
224
225 Lock (IN ubik_tid *tid,
226 afs_int32 file,
227 afs_int32 position,
228 afs_int32 length,
229 afs_int32 type) = DISK_LOCK;
230
231 Write (IN ubik_tid *tid,
232 afs_int32 file,
233 afs_int32 position,
234 bulkdata *data) = DISK_WRITE;
235
236 GetVersion (OUT ubik_version *Version) = DISK_GETVERSION;
237
238 GetFile (IN afs_int32 file,
239 OUT ubik_version *Version) split = DISK_GETFILE;
240
241 SendFile (IN afs_int32 file,
242 afs_int32 length,
243 ubik_version *Version) split = DISK_SENDFILE ;
244
245 Abort (IN ubik_tid *tid) = DISK_ABORT;
246
247 ReleaseLocks (IN ubik_tid *tid) = DISK_RELEASELOCKS;
248
249 Truncate (IN ubik_tid *tid,
250 afs_int32 file,
251 afs_int32 length) = DISK_TRUNCATE;
252
253 Probe () multi = DISK_PROBE;
254
255 WriteV (IN ubik_tid *tid,
256 iovec_wrt *io_vector,
257 iovec_buf *io_buffer) = DISK_WRITEV;
258
259 UpdateInterfaceAddr(IN UbikInterfaceAddr* inAddr,
260 OUT UbikInterfaceAddr* outAddr) multi = DISK_INTERFACEADDR;
261
262 SetVersion (IN ubik_tid *tid,
263 IN ubik_version *OldVersion,
264 IN ubik_version *NewVersion) = DISK_SETVERSION;