Introducer nodes use the same 'advertised_ip_addresses' file as client
nodes. They also use 'authorized_keys.SSHPORT'.
-encoding_parameters (optional): This file sets the encoding parameters that
-will be distributed to all client nodes and used when they encode files
-(unless locally overridden). It should contain three numbers, separated by
-whitespace, called "needed", "desired", and "total".
-
- "needed": this is the number of shares that will be needed to reconstruct
- the file. Each share that is pushed to a StorageServer will be
- the size of the original file divided by this number.
- "desired": the encoding/upload process will be happy if it can push
- this many shares to StorageServers. If it cannot, it will
- report failure.
- "total": this is the total number of shares that will be produced. The
- expansion factor (i.e. the amount of space consumed on the whole
- grid divided by the size of the file) will be total/needed. It does
- not make a lot of sense to have "total" be much larger than the
- maximum number of storage nodes you expect to ever have.
-
-The default value of encoding_parameters is "3 7 10".
+There are no additional configuration parameters for the introducer.
== Introducer state ==
class IntroducerNode(node.Node):
PORTNUMFILE = "introducer.port"
NODETYPE = "introducer"
- ENCODING_PARAMETERS_FILE = "encoding_parameters"
- DEFAULT_K, DEFAULT_DESIRED, DEFAULT_N = 3, 7, 10
def __init__(self, basedir="."):
node.Node.__init__(self, basedir)
self.init_introducer()
def init_introducer(self):
- k, desired, n = self.DEFAULT_K, self.DEFAULT_DESIRED, self.DEFAULT_N
- data = self.get_config("encoding_parameters")
- if data is not None:
- k,desired,n = data.split()
- k = int(k); desired = int(desired); n = int(n)
- introducerservice = IntroducerService(self.basedir, (k, desired, n))
+ introducerservice = IntroducerService(self.basedir)
self.add_service(introducerservice)
d = self.when_tub_ready()
implements(RIIntroducerPublisherAndSubscriberService)
name = "introducer"
- def __init__(self, basedir=".", encoding_parameters=None):
+ def __init__(self, basedir="."):
service.MultiService.__init__(self)
self.introducer_url = None
self._announcements = set()
self._subscribers = {}
- self._encoding_parameters = encoding_parameters
def log(self, *args, **kwargs):
if "facility" not in kwargs:
d = subscriber.callRemote("announce", announcements)
d.addErrback(log.err, facility="tahoe.introducer", level=log.UNUSUAL)
- def UNKNOWN(): # TODO
- if self._encoding_parameters is not None:
- node.callRemote("set_encoding_parameters",
- self._encoding_parameters)
-
class RemoteServiceConnector:
d = fireEventually(None)
d.addCallback(lambda res: q.startService())
d.addCallback(lambda res: q.when_tub_ready())
- def _check_parameters(res):
- i = q.getServiceNamed("introducer")
- self.failUnlessEqual(i._encoding_parameters, (3, 7, 10))
- d.addCallback(_check_parameters)
- d.addCallback(lambda res: q.stopService())
- d.addCallback(flushEventualQueue)
- return d
-
- def test_set_parameters(self):
- basedir = "introducer.IntroducerNode.test_set_parameters"
- os.mkdir(basedir)
- f = open(os.path.join(basedir, "encoding_parameters"), "w")
- f.write("25 75 100")
- f.close()
- q = IntroducerNode(basedir)
- d = fireEventually(None)
- d.addCallback(lambda res: q.startService())
- d.addCallback(lambda res: q.when_tub_ready())
- def _check_parameters(res):
- i = q.getServiceNamed("introducer")
- self.failUnlessEqual(i._encoding_parameters, (25, 75, 100))
- d.addCallback(_check_parameters)
d.addCallback(lambda res: q.stopService())
d.addCallback(flushEventualQueue)
return d