mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
introducer: remove encoding-parameter config, for now
This commit is contained in:
parent
3f8df27063
commit
a7867aeea2
@ -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
|
Introducer nodes use the same 'advertised_ip_addresses' file as client
|
||||||
nodes. They also use 'authorized_keys.SSHPORT'.
|
nodes. They also use 'authorized_keys.SSHPORT'.
|
||||||
|
|
||||||
encoding_parameters (optional): This file sets the encoding parameters that
|
There are no additional configuration parameters for the introducer.
|
||||||
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".
|
|
||||||
|
|
||||||
|
|
||||||
== Introducer state ==
|
== Introducer state ==
|
||||||
|
@ -12,20 +12,13 @@ from allmydata.util import log, idlib
|
|||||||
class IntroducerNode(node.Node):
|
class IntroducerNode(node.Node):
|
||||||
PORTNUMFILE = "introducer.port"
|
PORTNUMFILE = "introducer.port"
|
||||||
NODETYPE = "introducer"
|
NODETYPE = "introducer"
|
||||||
ENCODING_PARAMETERS_FILE = "encoding_parameters"
|
|
||||||
DEFAULT_K, DEFAULT_DESIRED, DEFAULT_N = 3, 7, 10
|
|
||||||
|
|
||||||
def __init__(self, basedir="."):
|
def __init__(self, basedir="."):
|
||||||
node.Node.__init__(self, basedir)
|
node.Node.__init__(self, basedir)
|
||||||
self.init_introducer()
|
self.init_introducer()
|
||||||
|
|
||||||
def init_introducer(self):
|
def init_introducer(self):
|
||||||
k, desired, n = self.DEFAULT_K, self.DEFAULT_DESIRED, self.DEFAULT_N
|
introducerservice = IntroducerService(self.basedir)
|
||||||
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))
|
|
||||||
self.add_service(introducerservice)
|
self.add_service(introducerservice)
|
||||||
|
|
||||||
d = self.when_tub_ready()
|
d = self.when_tub_ready()
|
||||||
@ -41,12 +34,11 @@ class IntroducerService(service.MultiService, Referenceable):
|
|||||||
implements(RIIntroducerPublisherAndSubscriberService)
|
implements(RIIntroducerPublisherAndSubscriberService)
|
||||||
name = "introducer"
|
name = "introducer"
|
||||||
|
|
||||||
def __init__(self, basedir=".", encoding_parameters=None):
|
def __init__(self, basedir="."):
|
||||||
service.MultiService.__init__(self)
|
service.MultiService.__init__(self)
|
||||||
self.introducer_url = None
|
self.introducer_url = None
|
||||||
self._announcements = set()
|
self._announcements = set()
|
||||||
self._subscribers = {}
|
self._subscribers = {}
|
||||||
self._encoding_parameters = encoding_parameters
|
|
||||||
|
|
||||||
def log(self, *args, **kwargs):
|
def log(self, *args, **kwargs):
|
||||||
if "facility" not in kwargs:
|
if "facility" not in kwargs:
|
||||||
@ -86,11 +78,6 @@ class IntroducerService(service.MultiService, Referenceable):
|
|||||||
d = subscriber.callRemote("announce", announcements)
|
d = subscriber.callRemote("announce", announcements)
|
||||||
d.addErrback(log.err, facility="tahoe.introducer", level=log.UNUSUAL)
|
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:
|
class RemoteServiceConnector:
|
||||||
|
@ -27,28 +27,6 @@ class TestIntroducerNode(testutil.SignalMixin, unittest.TestCase):
|
|||||||
d = fireEventually(None)
|
d = fireEventually(None)
|
||||||
d.addCallback(lambda res: q.startService())
|
d.addCallback(lambda res: q.startService())
|
||||||
d.addCallback(lambda res: q.when_tub_ready())
|
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(lambda res: q.stopService())
|
||||||
d.addCallback(flushEventualQueue)
|
d.addCallback(flushEventualQueue)
|
||||||
return d
|
return d
|
||||||
|
Loading…
Reference in New Issue
Block a user