"n": n,
"max_segment_size": max_segsize,
}
- self.node.DEFAULT_ENCODING_PARAMETERS = p
+ self.node.encoding_params = p
class FakeStorageServer:
def __init__(self, mode):
"n": 100,
"max_segment_size": 1*MiB,
}
+
def __init__(self, mode="good", num_servers=50):
self.num_servers = num_servers
+ self.encoding_params = self.DEFAULT_ENCODING_PARAMETERS.copy()
if type(mode) is str:
mode = dict([i,mode] for i in range(num_servers))
servers = [ ("%20d"%fakeid, FakeStorageServer(mode[fakeid]))
def log(self, *args, **kwargs):
pass
def get_encoding_parameters(self):
- return self.DEFAULT_ENCODING_PARAMETERS
+ return self.encoding_params
def get_storage_broker(self):
return self.storage_broker
_secret_holder = client.SecretHolder("lease secret", "convergence secret")
"n": n,
"max_segment_size": max_segsize,
}
- self.node.DEFAULT_ENCODING_PARAMETERS = p
+ self.node.encoding_params = p
def test_one_each(self):
# if we have 50 shares, and there are 50 servers, and they all accept
def _has_happy_share_distribution(self):
servertoshnums = self.find_all_shares()
- k = self.g.clients[0].DEFAULT_ENCODING_PARAMETERS['k']
- h = self.g.clients[0].DEFAULT_ENCODING_PARAMETERS['happy']
+ k = self.g.clients[0].encoding_params['k']
+ h = self.g.clients[0].encoding_params['happy']
return is_happy_enough(servertoshnums, h, k)
def _add_server(self, server_number, readonly=False):
"""
self._setup_grid()
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = 1
+ client.encoding_params['happy'] = 1
if "n" in kwargs and "k" in kwargs:
- client.DEFAULT_ENCODING_PARAMETERS['k'] = kwargs['k']
- client.DEFAULT_ENCODING_PARAMETERS['n'] = kwargs['n']
+ client.encoding_params['k'] = kwargs['k']
+ client.encoding_params['n'] = kwargs['n']
data = upload.Data("data" * 10000, convergence="")
self.data = data
d = client.upload(data)
# work with 5, as long as the original 4 are not stuck in the open
# BucketWriter state (open() but not
parms = {"k":2, "happy":5, "n":5, "max_segment_size": 1*MiB}
- c.DEFAULT_ENCODING_PARAMETERS = parms
+ c.encoding_params = parms
d = self.shouldFail(UploadUnhappinessError, "test_aborted_shares",
"shares could be placed on only 4 "
"server(s) such that any 2 of them have enough "
# Set happy = 4 in the client.
def _prepare():
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = 4
+ client.encoding_params['happy'] = 4
return client
d.addCallback(lambda ign:
_prepare())
readonly=True))
def _prepare2():
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = 4
+ client.encoding_params['happy'] = 4
return client
d.addCallback(lambda ign:
_prepare2())
# Ideally, a reupload of our original data should work.
def _reset_encoding_parameters(ign, happy=4):
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = happy
+ client.encoding_params['happy'] = happy
return client
d.addCallback(_reset_encoding_parameters)
d.addCallback(lambda client:
# Copy shares
self._copy_share_to_server(3, 1)
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = 4
+ client.encoding_params['happy'] = 4
return client
d.addCallback(_setup)
readonly=True))
def _reset_encoding_parameters(ign, happy=4):
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = happy
+ client.encoding_params['happy'] = happy
return client
d.addCallback(_reset_encoding_parameters)
d.addCallback(lambda client:
self.g.remove_server(self.g.servers_by_number[0].my_nodeid))
def _reset_encoding_parameters(ign, happy=4):
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = happy
+ client.encoding_params['happy'] = happy
return client
d.addCallback(_reset_encoding_parameters)
d.addCallback(lambda client:
self.g.remove_server(self.g.servers_by_number[0].my_nodeid))
def _prepare_client(ign):
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = 4
+ client.encoding_params['happy'] = 4
return client
d.addCallback(_prepare_client)
d.addCallback(lambda client:
# counting in the exception message. The same progress message
# is also used when the upload is successful, but in that case it
# only gets written to a log, so we can't see what it says.
- c.DEFAULT_ENCODING_PARAMETERS['happy'] = 45
+ c.encoding_params['happy'] = 45
return c
d.addCallback(_setup)
d.addCallback(lambda c:
self._add_server(server_number=12, readonly=True)
self.g.remove_server(self.g.servers_by_number[0].my_nodeid)
c = self.g.clients[0]
- c.DEFAULT_ENCODING_PARAMETERS['happy'] = 45
+ c.encoding_params['happy'] = 45
return c
d.addCallback(_then)
d.addCallback(lambda c:
self.g.remove_server(self.g.servers_by_number[0].my_nodeid)
# Make happiness unsatisfiable
c = self.g.clients[0]
- c.DEFAULT_ENCODING_PARAMETERS['happy'] = 45
+ c.encoding_params['happy'] = 45
return c
d.addCallback(_next)
d.addCallback(lambda c:
self._add_server(server_number=i, readonly=True)
self.g.remove_server(self.g.servers_by_number[0].my_nodeid)
c = self.g.clients[0]
- c.DEFAULT_ENCODING_PARAMETERS['k'] = 2
- c.DEFAULT_ENCODING_PARAMETERS['happy'] = 4
- c.DEFAULT_ENCODING_PARAMETERS['n'] = 4
+ c.encoding_params['k'] = 2
+ c.encoding_params['happy'] = 4
+ c.encoding_params['n'] = 4
return c
d.addCallback(_then)
d.addCallback(lambda client:
self.g.remove_server(self.g.servers_by_number[0].my_nodeid))
def _reset_encoding_parameters(ign, happy=4):
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = happy
+ client.encoding_params['happy'] = happy
return client
d.addCallback(_reset_encoding_parameters)
d.addCallback(lambda client:
# Remove server 0
self.g.remove_server(self.g.servers_by_number[0].my_nodeid)
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = 3
+ client.encoding_params['happy'] = 3
return client
d.addCallback(_setup)
# create an empty storedir to replace the one we just removed
os.mkdir(storedir)
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = 4
+ client.encoding_params['happy'] = 4
return client
d.addCallback(_setup)
# create an empty storedir to replace the one we just removed
os.mkdir(storedir)
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = 4
+ client.encoding_params['happy'] = 4
return client
d.addCallback(_setup)
self.g.remove_server(self.g.servers_by_number[0].my_nodeid)
# Set the client appropriately
c = self.g.clients[0]
- c.DEFAULT_ENCODING_PARAMETERS['happy'] = 4
+ c.encoding_params['happy'] = 4
return c
d.addCallback(_server_setup)
d.addCallback(lambda client:
# the current grid. This will fail, but should not take up any
# space on the storage servers after it fails.
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = 7
+ client.encoding_params['happy'] = 7
d = defer.succeed(None)
d.addCallback(lambda ignored:
self.shouldFail(UploadUnhappinessError,
self.set_up_grid(num_servers=4)
client = self.g.clients[0]
- client.DEFAULT_ENCODING_PARAMETERS['happy'] = 7
+ client.encoding_params['happy'] = 7
d = defer.succeed(None)
d.addCallback(lambda ignored: