﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	launchpad_bug
271	implement new publish/subscribe introduction scheme	zooko	warner	"Implement the new publish/subscribe introduction scheme we've been discussing
recently:

 * enumerate the services which can be published and queried for:
   * upload storage server (ones which will accept new shares)
   * download storage server (ones which will let you read shares)
     * (soon-to-be-decommissioned storage servers will be download-only)
   * helpers and other introducers may be added to this list, but we need
     to talk about that more first.. I'm not sure about it.

 * all nodes should have an !IntroducerClient, as an attribute of the Node
   instance.

 * to publish a service, do e.g.:

{{{
    if self.get_config(""offer_storage""):
        ss = StorageServer()
        ss.setServiceParent(self)
        self.introducer.publish(ss, ""upload_storage"")
        self.introducer.pushing(ss, ""download_storage"")
}}}

 * if the node cares about a particular service, it must register that intent
   at startup:

{{{
    if want_storage_servers:
        self.introducer.subscribe_to(""upload_storage"")
        self.introducer.subscribe_to(""download_storage"")
}}}

 * then, to access a service, there are two APIs: one that does permutation
   (for upload/download) and one which just returns a flat list (mostly for
   the welcome page):

{{{
    ppeers = self.introducer.get_permuted_peers(""download_storage"", storage_index)
    # ppeers is a list of (permuted_peerid, peerid, RemoteReference)
    all_peers = self.introducer.get_peers(""upload_storage"")
}}}

 * add config flags to disable upload, and to disable storage completely.
   Client installs (i.e. those created by py2exe) will disable storage
   service by default. Storage-only nodes won't subscribe to hear about other
   storage nodes.


Other things to think about:

 * get_permuted_peers could return a Deferred (which would make it easier for
   us to create a special kind of helper which knows about peers for you), or
   return an iterator, or both, somehow. To actually make this useful is
   non-trivial (to reduce the memory footprint, you'd want an iterator that
   yields Deferreds, but that might also impose a stupidly large number of
   roundtrips to a query). We should probably wait until we identify a need
   for this before implementing any part of it.
 * This API implies a publish/subscribe model in which the subscription
   accumulates knowledge about peers, and the actual point of use (i.e.
   upload or download) samples whatever peers have been acquired by that
   time. This might not be the best approach.
"	enhancement	closed	major	0.8.0 (Allmydata 3.0 Beta)	code-network	0.7.0	fixed			
