1 | Sat Aug 7 11:03:51 BST 2010 writefaruq@gmail.com |
---|
2 | * multiple-introducer-client-side-001.dpatch |
---|
3 | client.py: Added support to read the multiple introducers config file "basedir/introducers" and to create necessary connections to all introducers. |
---|
4 | web/root.py: Fetches the connection status of all introducer_clients from client |
---|
5 | web/welcome.xhtml: shows the intriducer FURLs and their connection status on WUI's welcome page |
---|
6 | |
---|
7 | |
---|
8 | New patches: |
---|
9 | |
---|
10 | [multiple-introducer-client-side-001.dpatch |
---|
11 | writefaruq@gmail.com**20100807100351 |
---|
12 | Ignore-this: ad73102b8e1196536782382170314451 |
---|
13 | client.py: Added support to read the multiple introducers config file "basedir/introducers" and to create necessary connections to all introducers. |
---|
14 | web/root.py: Fetches the connection status of all introducer_clients from client |
---|
15 | web/welcome.xhtml: shows the intriducer FURLs and their connection status on WUI's welcome page |
---|
16 | |
---|
17 | ] { |
---|
18 | hunk ./src/allmydata/client.py 34 |
---|
19 | TiB=1024*GiB |
---|
20 | PiB=1024*TiB |
---|
21 | |
---|
22 | +MULTI_INTRODUCERS_CFG = "introducers" |
---|
23 | + |
---|
24 | class StubClient(Referenceable): |
---|
25 | implements(RIStubClient) |
---|
26 | |
---|
27 | hunk ./src/allmydata/client.py 128 |
---|
28 | self.started_timestamp = time.time() |
---|
29 | self.logSource="Client" |
---|
30 | self.DEFAULT_ENCODING_PARAMETERS = self.DEFAULT_ENCODING_PARAMETERS.copy() |
---|
31 | - self.init_introducer_client() |
---|
32 | + self.init_introducer_clients() |
---|
33 | self.init_stats_provider() |
---|
34 | self.init_secrets() |
---|
35 | self.init_storage() |
---|
36 | hunk ./src/allmydata/client.py 175 |
---|
37 | if os.path.exists(os.path.join(self.basedir, "run_helper")): |
---|
38 | self.set_config("helper", "enabled", "true") |
---|
39 | |
---|
40 | - def init_introducer_client(self): |
---|
41 | - self.introducer_furl = self.get_config("client", "introducer.furl") |
---|
42 | - ic = IntroducerClient(self.tub, self.introducer_furl, |
---|
43 | + def init_introducer_clients(self): |
---|
44 | + self.introducer_furls = [] |
---|
45 | + self.warn_flag = False |
---|
46 | + # Try to load ""BASEDIR/introducers" cfg file |
---|
47 | + cfg = os.path.join(self.basedir, MULTI_INTRODUCERS_CFG) |
---|
48 | + if os.path.exists(cfg): |
---|
49 | + f = open(cfg, 'r') |
---|
50 | + for introducer_furl in f.read().split('\n'): |
---|
51 | + if not introducer_furl.strip(): |
---|
52 | + continue |
---|
53 | + self.introducer_furls.append(introducer_furl) |
---|
54 | + f.close() |
---|
55 | + furl_count = len(self.introducer_furls) |
---|
56 | + #print "@icfg: furls: %d" %furl_count |
---|
57 | + |
---|
58 | + # read furl from tahoe.cfg |
---|
59 | + ifurl = self.get_config("client", "introducer.furl", None) |
---|
60 | + if ifurl not in self.introducer_furls: |
---|
61 | + self.introducer_furls.append(ifurl) |
---|
62 | + f = open(cfg, 'a') |
---|
63 | + f.writelines(ifurl) |
---|
64 | + f.write('\n') |
---|
65 | + f.close() |
---|
66 | + if furl_count > 1: |
---|
67 | + self.warn_flag = True |
---|
68 | + self.log("introducers config file modified.") |
---|
69 | + print "Warning! introducers config file modified." |
---|
70 | + |
---|
71 | + # create a pool of introducer_clients |
---|
72 | + self.introducer_clients = [] |
---|
73 | + for introducer_furl in self.introducer_furls: |
---|
74 | + ic = IntroducerClient(self.tub, introducer_furl, |
---|
75 | self.nickname, |
---|
76 | str(allmydata.__full_version__), |
---|
77 | str(self.OLDEST_SUPPORTED_VERSION)) |
---|
78 | hunk ./src/allmydata/client.py 210 |
---|
79 | - self.introducer_client = ic |
---|
80 | + self.introducer_clients.append(ic) |
---|
81 | + # init introducer_clients as usual |
---|
82 | + for ic in self.introducer_clients: |
---|
83 | + self.init_introducer_client(ic) |
---|
84 | + |
---|
85 | + def init_introducer_client(self, ic): |
---|
86 | # hold off on starting the IntroducerClient until our tub has been |
---|
87 | # started, so we'll have a useful address on our RemoteReference, so |
---|
88 | # that the introducer's status page will show us. |
---|
89 | hunk ./src/allmydata/client.py 303 |
---|
90 | furl_file = os.path.join(self.basedir, "private", "storage.furl") |
---|
91 | furl = self.tub.registerReference(ss, furlFile=furl_file) |
---|
92 | ri_name = RIStorageServer.__remote_name__ |
---|
93 | - self.introducer_client.publish(furl, "storage", ri_name) |
---|
94 | + # Now, publish multiple introducers |
---|
95 | + for ic in self.introducer_clients: |
---|
96 | + ic.publish(furl, "storage", ri_name) |
---|
97 | d.addCallback(_publish) |
---|
98 | d.addErrback(log.err, facility="tahoe.init", |
---|
99 | level=log.BAD, umid="aLGBKw") |
---|
100 | hunk ./src/allmydata/client.py 359 |
---|
101 | # check to see if we're supposed to use the introducer too |
---|
102 | if self.get_config("client-server-selection", "use_introducer", |
---|
103 | default=True, boolean=True): |
---|
104 | - sb.use_introducer(self.introducer_client) |
---|
105 | + |
---|
106 | + # Now, use our multiple introducers |
---|
107 | + for ic in self.introducer_clients: |
---|
108 | + sb.use_introducer(ic) |
---|
109 | |
---|
110 | def get_storage_broker(self): |
---|
111 | return self.storage_broker |
---|
112 | hunk ./src/allmydata/client.py 375 |
---|
113 | sc = StubClient() |
---|
114 | furl = self.tub.registerReference(sc) |
---|
115 | ri_name = RIStubClient.__remote_name__ |
---|
116 | - self.introducer_client.publish(furl, "stub_client", ri_name) |
---|
117 | + # Now publish our multiple introducers |
---|
118 | + for ic in self.introducer_clients: |
---|
119 | + ic.publish(furl, "stub_client", ri_name) |
---|
120 | d = self.when_tub_ready() |
---|
121 | d.addCallback(_publish) |
---|
122 | d.addErrback(log.err, facility="tahoe.init", |
---|
123 | hunk ./src/allmydata/client.py 489 |
---|
124 | |
---|
125 | def get_encoding_parameters(self): |
---|
126 | return self.DEFAULT_ENCODING_PARAMETERS |
---|
127 | - |
---|
128 | + |
---|
129 | + # In case we configure multiple introducers |
---|
130 | def connected_to_introducer(self): |
---|
131 | hunk ./src/allmydata/client.py 492 |
---|
132 | - if self.introducer_client: |
---|
133 | - return self.introducer_client.connected_to_introducer() |
---|
134 | - return False |
---|
135 | - |
---|
136 | + status = [] |
---|
137 | + if self.introducer_clients: |
---|
138 | + s = False |
---|
139 | + for ic in self.introducer_clients: |
---|
140 | + s = ic.connected_to_introducer() |
---|
141 | + status.append(s) |
---|
142 | + return status |
---|
143 | + |
---|
144 | def get_renewal_secret(self): # this will go away |
---|
145 | return self._secret_holder.get_renewal_secret() |
---|
146 | |
---|
147 | hunk ./src/allmydata/web/root.py 220 |
---|
148 | |
---|
149 | return ctx.tag[ul] |
---|
150 | |
---|
151 | - def data_introducer_furl(self, ctx, data): |
---|
152 | - return self.client.introducer_furl |
---|
153 | - def data_connected_to_introducer(self, ctx, data): |
---|
154 | - if self.client.connected_to_introducer(): |
---|
155 | - return "yes" |
---|
156 | - return "no" |
---|
157 | + # In case we configure multiple introducers |
---|
158 | + def data_introducers(self, ctx, data): |
---|
159 | + connection_status = self.client.connected_to_introducer() |
---|
160 | + s = [] |
---|
161 | + furls = self.client.introducer_furls |
---|
162 | + for furl in furls: |
---|
163 | + i = furls.index(furl) |
---|
164 | + if connection_status[i]: |
---|
165 | + s.append( (furl, "Yes") ) |
---|
166 | + else: |
---|
167 | + s.append( (furl, "No") ) |
---|
168 | + s.sort() |
---|
169 | + return s |
---|
170 | + |
---|
171 | + def render_introducers_row(self, ctx, s): |
---|
172 | + (furl, connected) = s |
---|
173 | + #connected = |
---|
174 | + ctx.fillSlots("introducer_furl", "%s" % (furl)) |
---|
175 | + ctx.fillSlots("connected", "%s" % (connected)) |
---|
176 | + return ctx.tag |
---|
177 | |
---|
178 | def data_helper_furl(self, ctx, data): |
---|
179 | try: |
---|
180 | hunk ./src/allmydata/web/welcome.xhtml 25 |
---|
181 | <tr><th>Tahoe-LAFS code imported from:</th> <td n:render="string" n:data="import_path" /></tr> |
---|
182 | <tr><th>Services running:</th> <td n:render="services" /></tr> |
---|
183 | </table> |
---|
184 | - |
---|
185 | + |
---|
186 | |
---|
187 | </div> |
---|
188 | |
---|
189 | hunk ./src/allmydata/web/welcome.xhtml 40 |
---|
190 | <div n:render="download_form" /> |
---|
191 | </div> |
---|
192 | |
---|
193 | +<h2>Connected Introducer(s)</h2> |
---|
194 | + |
---|
195 | +<div> |
---|
196 | +<table n:render="sequence" n:data="introducers"> |
---|
197 | + <tr n:pattern="header"> |
---|
198 | + <td>Introducer FURL</td> |
---|
199 | + <td>Connected?</td> |
---|
200 | + </tr> |
---|
201 | + <tr n:pattern="item" n:render="introducers_row"> |
---|
202 | + <td><tt><n:slot name="introducer_furl"/></tt></td> |
---|
203 | + <td><tt><n:slot name="connected"/></tt></td> |
---|
204 | + </tr> |
---|
205 | + <tr n:pattern="empty"><td>no introducers!</td></tr> |
---|
206 | +</table> |
---|
207 | +</div> |
---|
208 | + |
---|
209 | + |
---|
210 | + |
---|
211 | <div class="section" id="grid"> |
---|
212 | <h2>Status of the Storage Grid</h2> |
---|
213 | |
---|
214 | hunk ./src/allmydata/web/welcome.xhtml 61 |
---|
215 | - <div> |
---|
216 | - <n:attr name="class">connected-<n:invisible n:render="string" n:data="connected_to_introducer" /></n:attr> |
---|
217 | - <div>Introducer: <span class="data-chars" n:render="string" n:data="introducer_furl" /></div> |
---|
218 | - <div>Connected to introducer?: <span n:render="string" n:data="connected_to_introducer" /></div> |
---|
219 | - </div> |
---|
220 | - |
---|
221 | <div> |
---|
222 | <n:attr name="class">connected-<n:invisible n:render="string" n:data="connected_to_helper" /></n:attr> |
---|
223 | <div>Helper: <span n:render="string" n:data="helper_furl" /></div> |
---|
224 | } |
---|
225 | |
---|
226 | Context: |
---|
227 | |
---|
228 | [abbreviate time edge case python2.5 unit test |
---|
229 | jacob.lyles@gmail.com**20100729210638 |
---|
230 | Ignore-this: 80f9b1dc98ee768372a50be7d0ef66af |
---|
231 | ] |
---|
232 | [docs: add Jacob Lyles to CREDITS |
---|
233 | zooko@zooko.com**20100730230500 |
---|
234 | Ignore-this: 9dbbd6a591b4b1a5a8dcb69b7b757792 |
---|
235 | ] |
---|
236 | [web: don't use %d formatting on a potentially large negative float -- there is a bug in Python 2.5 in that case |
---|
237 | jacob.lyles@gmail.com**20100730220550 |
---|
238 | Ignore-this: 7080eb4bddbcce29cba5447f8f4872ee |
---|
239 | fixes #1055 |
---|
240 | ] |
---|
241 | [test_upload.py: rename test_problem_layout_ticket1124 to test_problem_layout_ticket_1124 -- fix .todo reference. |
---|
242 | david-sarah@jacaranda.org**20100729152927 |
---|
243 | Ignore-this: c8fe1047edcc83c87b9feb47f4aa587b |
---|
244 | ] |
---|
245 | [test_upload.py: rename test_problem_layout_ticket1124 to test_problem_layout_ticket_1124 for consistency. |
---|
246 | david-sarah@jacaranda.org**20100729142250 |
---|
247 | Ignore-this: bc3aad5919ae9079ceb9968ad0f5ea5a |
---|
248 | ] |
---|
249 | [docs: fix licensing typo that was earlier fixed in [20090921164651-92b7f-7f97b58101d93dc588445c52a9aaa56a2c7ae336] |
---|
250 | zooko@zooko.com**20100729052923 |
---|
251 | Ignore-this: a975d79115911688e5469d4d869e1664 |
---|
252 | I wish we didn't copies of this licensing text in several different files so that changes can be accidentally omitted from some of them. |
---|
253 | ] |
---|
254 | [misc/build_helpers/run-with-pythonpath.py: fix stale comment, and remove 'trial' example that is not the right way to run trial. |
---|
255 | david-sarah@jacaranda.org**20100726225729 |
---|
256 | Ignore-this: a61f55557ad69a1633bfb2b8172cce97 |
---|
257 | ] |
---|
258 | [docs/specifications/dirnodes.txt: 'mesh'->'grid'. |
---|
259 | david-sarah@jacaranda.org**20100723061616 |
---|
260 | Ignore-this: 887bcf921ef00afba8e05e9239035bca |
---|
261 | ] |
---|
262 | [docs/specifications/dirnodes.txt: bring layer terminology up-to-date with architecture.txt, and a few other updates (e.g. note that the MAC is no longer verified, and that URIs can be unknown). Also 'Tahoe'->'Tahoe-LAFS'. |
---|
263 | david-sarah@jacaranda.org**20100723054703 |
---|
264 | Ignore-this: f3b98183e7d0a0f391225b8b93ac6c37 |
---|
265 | ] |
---|
266 | [docs: use current cap to Zooko's wiki page in example text |
---|
267 | zooko@zooko.com**20100721010543 |
---|
268 | Ignore-this: 4f36f36758f9fdbaf9eb73eac23b6652 |
---|
269 | fixes #1134 |
---|
270 | ] |
---|
271 | [__init__.py: silence DeprecationWarning about BaseException.message globally. fixes #1129 |
---|
272 | david-sarah@jacaranda.org**20100720011939 |
---|
273 | Ignore-this: 38808986ba79cb2786b010504a22f89 |
---|
274 | ] |
---|
275 | [test_runner: test that 'tahoe --version' outputs no noise (e.g. DeprecationWarnings). |
---|
276 | david-sarah@jacaranda.org**20100720011345 |
---|
277 | Ignore-this: dd358b7b2e5d57282cbe133e8069702e |
---|
278 | ] |
---|
279 | [TAG allmydata-tahoe-1.7.1 |
---|
280 | zooko@zooko.com**20100719131352 |
---|
281 | Ignore-this: 6942056548433dc653a746703819ad8c |
---|
282 | ] |
---|
283 | Patch bundle hash: |
---|
284 | a333c46f469094bcbc76587a19d99d7a82c15532 |
---|