From a7867aeea229580a1b578197a5b4bd7346db7659 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@allmydata.com>
Date: Tue, 12 Feb 2008 18:59:54 -0700
Subject: [PATCH] introducer: remove encoding-parameter config, for now

---
 docs/configuration.txt                | 19 +------------------
 src/allmydata/introducer.py           | 17 ++---------------
 src/allmydata/test/test_introducer.py | 22 ----------------------
 3 files changed, 3 insertions(+), 55 deletions(-)

diff --git a/docs/configuration.txt b/docs/configuration.txt
index 3a8b4207..03202cc8 100644
--- a/docs/configuration.txt
+++ b/docs/configuration.txt
@@ -127,24 +127,7 @@ centralized storage meshes to gather operational logs in a single place.
 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 ==
diff --git a/src/allmydata/introducer.py b/src/allmydata/introducer.py
index 62172157..b1b58345 100644
--- a/src/allmydata/introducer.py
+++ b/src/allmydata/introducer.py
@@ -12,20 +12,13 @@ from allmydata.util import log, idlib
 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()
@@ -41,12 +34,11 @@ class IntroducerService(service.MultiService, Referenceable):
     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:
@@ -86,11 +78,6 @@ class IntroducerService(service.MultiService, Referenceable):
         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:
diff --git a/src/allmydata/test/test_introducer.py b/src/allmydata/test/test_introducer.py
index f70e0739..65ac8719 100644
--- a/src/allmydata/test/test_introducer.py
+++ b/src/allmydata/test/test_introducer.py
@@ -27,28 +27,6 @@ class TestIntroducerNode(testutil.SignalMixin, unittest.TestCase):
         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
-- 
2.45.2