Fri Jul 9 18:33:59 BST 2010 writefaruq@gmail.com * enable_client_with_multi_introducer.dpatch Using this patch client can read a config file basedir/intoducers that contains the furls of introducers one per line. Client uses these furls along with the furl from tahoe.cfg to connect to the introducers. Statuses of these connections are listed in client's welcome page. New patches: [enable_client_with_multi_introducer.dpatch writefaruq@gmail.com**20100709173359 Ignore-this: 2b4c9553b2c150ee8ba3c5d86cf148fd Using this patch client can read a config file basedir/intoducers that contains the furls of introducers one per line. Client uses these furls along with the furl from tahoe.cfg to connect to the introducers. Statuses of these connections are listed in client's welcome page. ] { hunk ./src/allmydata/client.py 34 TiB=1024*GiB PiB=1024*TiB +MULTI_INTRODUCERS_CFG = "introducers" + class StubClient(Referenceable): implements(RIStubClient) hunk ./src/allmydata/client.py 128 self.started_timestamp = time.time() self.logSource="Client" self.DEFAULT_ENCODING_PARAMETERS = self.DEFAULT_ENCODING_PARAMETERS.copy() - self.init_introducer_client() + self.init_introducer_clients() self.init_stats_provider() self.init_secrets() self.init_storage() hunk ./src/allmydata/client.py 175 if os.path.exists(os.path.join(self.basedir, "run_helper")): self.set_config("helper", "enabled", "true") - def init_introducer_client(self): - self.introducer_furl = self.get_config("client", "introducer.furl") - ic = IntroducerClient(self.tub, self.introducer_furl, + def init_introducer_clients(self): + # read first furl from tahoe.cfg + introducer_furl1 = self.get_config("client", "introducer.furl", None) + self.introducer_furls = [] + if introducer_furl1: + self.introducer_furls.append(introducer_furl1) + # read from ""BASEDIR/introducers" cfg file + cfg = os.path.join(self.basedir, MULTI_INTRODUCERS_CFG) + if os.path.exists(cfg): + f = open(cfg, 'r') + for introducer_furl in f.read().split('\n'): + if not introducer_furl.strip(): + continue + self.introducer_furls.append(introducer_furl) + f.close() + # create a pool of introducer_clients + self.introducer_clients = [] + for introducer_furl in self.introducer_furls: + ic = IntroducerClient(self.tub, introducer_furl, self.nickname, str(allmydata.__full_version__), str(self.OLDEST_SUPPORTED_VERSION)) hunk ./src/allmydata/client.py 197 - self.introducer_client = ic + self.introducer_clients.append(ic) + # init introducer_clients as usual + for ic in self.introducer_clients: + self.init_introducer_client(ic) + + def init_introducer_client(self, ic): # hold off on starting the IntroducerClient until our tub has been # started, so we'll have a useful address on our RemoteReference, so # that the introducer's status page will show us. hunk ./src/allmydata/client.py 290 furl_file = os.path.join(self.basedir, "private", "storage.furl") furl = self.tub.registerReference(ss, furlFile=furl_file) ri_name = RIStorageServer.__remote_name__ - self.introducer_client.publish(furl, "storage", ri_name) + # Now, publish our multi-introducers + for ic in self.introducer_clients: + ic.publish(furl, "storage", ri_name) d.addCallback(_publish) d.addErrback(log.err, facility="tahoe.init", level=log.BAD, umid="aLGBKw") hunk ./src/allmydata/client.py 346 # check to see if we're supposed to use the introducer too if self.get_config("client-server-selection", "use_introducer", default=True, boolean=True): - sb.use_introducer(self.introducer_client) + + # Now, use our multi-introducers + for ic in self.introducer_clients: + sb.use_introducer(ic) def get_storage_broker(self): return self.storage_broker hunk ./src/allmydata/client.py 362 sc = StubClient() furl = self.tub.registerReference(sc) ri_name = RIStubClient.__remote_name__ - self.introducer_client.publish(furl, "stub_client", ri_name) + # Now publish our multiple introducers + for ic in self.introducer_clients: + ic.publish(furl, "stub_client", ri_name) d = self.when_tub_ready() d.addCallback(_publish) d.addErrback(log.err, facility="tahoe.init", hunk ./src/allmydata/client.py 476 def get_encoding_parameters(self): return self.DEFAULT_ENCODING_PARAMETERS - + + # In case we configure multiple introducers def connected_to_introducer(self): hunk ./src/allmydata/client.py 479 - if self.introducer_client: - return self.introducer_client.connected_to_introducer() - return False - + status = [] + if self.introducer_clients: + s = False + for ic in self.introducer_clients: + s = ic.connected_to_introducer() + status.append(s) + return status + def get_renewal_secret(self): # this will go away return self._secret_holder.get_renewal_secret() hunk ./src/allmydata/web/root.py 220 return ctx.tag[ul] - def data_introducer_furl(self, ctx, data): - return self.client.introducer_furl - def data_connected_to_introducer(self, ctx, data): - if self.client.connected_to_introducer(): - return "yes" - return "no" + # In case we configure multiple introducers + def data_introducers(self, ctx, data): + connection_status = self.client.connected_to_introducer() + s = [] + furls = self.client.introducer_furls + for furl in furls: + i = furls.index(furl) + if connection_status[i]: + s.append( (furl, "Yes") ) + else: + s.append( (furl, "No") ) + s.sort() + return s + + def render_introducers_row(self, ctx, s): + (furl, connected) = s + #connected = + ctx.fillSlots("introducer_furl", "%s" % (furl)) + ctx.fillSlots("connected", "%s" % (connected)) + return ctx.tag def data_helper_furl(self, ctx, data): try: hunk ./src/allmydata/web/welcome.xhtml 25 Tahoe-LAFS code imported from: Services running: - + hunk ./src/allmydata/web/welcome.xhtml 40
+

Connected Introducer(s)

+ +
+ + + + + + + + + + +
Introducer FURLConnected?
no introducers!
+
+ + +

Status of the Storage Grid

hunk ./src/allmydata/web/welcome.xhtml 61 -
- connected- -
Introducer:
-
Connected to introducer?:
-
-
connected-
Helper:
hunk ./src/allmydata/web/welcome.xhtml 103

Other Resources

-
Please visit the Tahoe-LAFS home page for +
Please visit the Tahoe-LAFS home page for code updates and bug reporting.
The provisioning tool and 2.6 as recommended version david-sarah@jacaranda.org**20100705175858 Ignore-this: bc3a14645ea1d5435002966ae903199f ] [SFTP: don't call .stopProducing on the producer registered with OverwriteableFileConsumer (which breaks with warner's new downloader). david-sarah@jacaranda.org**20100628231926 Ignore-this: 131b7a5787bc85a9a356b5740d9d996f ] [docs/how_to_make_a_tahoe-lafs_release.txt: trivial correction, install.html should now be quickstart.html. david-sarah@jacaranda.org**20100625223929 Ignore-this: 99a5459cac51bd867cc11ad06927ff30 ] [setup: in the Makefile, refuse to upload tarballs unless someone has passed the environment variable "BB_BRANCH" with value "trunk" zooko@zooko.com**20100619034928 Ignore-this: 276ddf9b6ad7ec79e27474862e0f7d6 ] [trivial: tiny update to in-line comment zooko@zooko.com**20100614045715 Ignore-this: 10851b0ed2abfed542c97749e5d280bc (I'm actually committing this patch as a test of the new eager-annotation-computation of trac-darcs.) ] [docs: about.html link to home page early on, and be decentralized storage instead of cloud storage this time around zooko@zooko.com**20100619065318 Ignore-this: dc6db03f696e5b6d2848699e754d8053 ] [docs: update about.html, especially to have a non-broken link to quickstart.html, and also to comment out the broken links to "for Paranoids" and "for Corporates" zooko@zooko.com**20100619065124 Ignore-this: e292c7f51c337a84ebfeb366fbd24d6c ] [TAG allmydata-tahoe-1.7.0 zooko@zooko.com**20100619052631 Ignore-this: d21e27afe6d85e2e3ba6a3292ba2be1 ] Patch bundle hash: 8c4c745fc13326220dfc53bb0112c89fce76a34d