Commit Graph

223 Commits

Author SHA1 Message Date
meejah
ec02d47bcc rename 2019-07-08 12:49:07 -06:00
meejah
e2717245ce use aliases 2019-06-24 16:57:59 -06:00
meejah
5701bad548 a module for errors 2019-06-24 12:12:10 -06:00
meejah
310fb60247 move AES to a helper-function style 2019-06-17 15:54:46 -06:00
meejah
df4671f90e refactor away from pycryptopp "helper" classes 2019-06-13 22:19:28 -06:00
heartsucker
1976f99201 fix signature verification 2019-06-13 22:19:28 -06:00
heartsucker
8063d93c6d replaced pytcryptopp rsa with our own wrapper 2019-06-13 22:19:28 -06:00
heartsucker
008825b0fd replaced referecnes to pycryptopp AES with own wrapper 2019-06-13 22:18:55 -06:00
Jean-Paul Calderone
72cf590320 Use IStorageServer instead of RemoteReference in a lot of places 2019-05-31 13:41:07 -04:00
tpltnt
c8f11dc2d3 ported old-style classes to new-style 2019-05-26 08:28:18 +02:00
heartsucker
a087a5be72
removed tuple unpacking in function definitons for python3 compatibility 2019-04-18 13:37:18 +02:00
heartsucker
0750dbac38
updated all python files to use pep-3110 exception syntax for python3 compatibility 2019-04-04 11:57:58 +02:00
heartsucker
dbfcf8ae00
replaced StringIO imports with six.moves 2019-03-28 12:31:37 +01:00
heartsucker
64f4dfa8ca
replaced all remaining instances of the print statement with the print function 2019-03-24 14:14:00 +01:00
Jean-Paul Calderone
6d9f0c59b7 Remove pointless conditional 2018-04-26 14:59:47 -04:00
Jean-Paul Calderone
da9d0ded94 Remove pointless conditional 2018-04-26 14:59:18 -04:00
Brian Warner
da4e7dcfbe hush a bunch of not-really-problems caught by the lgtm.com static analyzer
This is all minor stuff: unreachable debug code (that should be commented-out
instead of in an 'if False:' block), unnecessary 'pass' and 'global'
statements, redundantly-initialized variables. No behavior changes. Nothing
here was actually broken, it just looked suspicious to the static analysis at
https://lgtm.com/projects/g/tahoe-lafs/tahoe-lafs/alerts/?mode=list .
2017-12-31 00:19:41 +01:00
Brian Warner
a4be2dce71 avoid variable coverage by using a defaultdict
refs ticket:2891
2017-07-27 18:19:57 -07:00
meejah
49ae2c5eb7 use @implementer instead of implements
Also, derive some more things from 'object'
2017-02-27 11:01:30 -07:00
meejah
db517e8edd Progress API
- IProgress interface + PercentProgress implementation
 - progress= args to many upload/download APIs
 - ultimately for magic-folder
2016-04-12 00:30:50 -07:00
Daira Hopwood
278ee0db76 Fix an error handling path that would never have been reached. fixes ticket:2543
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-02-02 18:55:34 +00:00
Brian Warner
29ab496bd7 mutable/retrieve.py: remove all bare assert()s
Replace them with _assert() or precondition(). Closes ticket:2462.
2015-07-28 13:32:46 -07:00
Brian Warner
89e9076c41 mutable/retrieve.py: rewrite partial-read handling
This should tolerate offset/size combinations that read the last byte of
the file, something which was broken before. It quits early in the case
of zero-byte reads, to simplify the resulting "which segments do I need"
logic. Probably addresses ticket:2459.
2015-07-28 10:13:32 -07:00
Daira Hopwood
9076db137a Remove some bare asserts in retrieve.py (there are still quite a few left). refs #2462
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-07-28 10:13:32 -07:00
Mark Berger
db12f1cffb Adds _servers_with_shares to ServermapUpdater
When calculating the query boundary for updates to mutable files,
instead of using servers that used to have shares, use servers we
have added to the servermap. This way the querying process won't finish
until we have finished interacting with the servers that have shares.

This fixes the race condition which sometimes caused the querying process
to finish before the updater was done talking to servers with shares.
2015-01-27 00:40:14 -08:00
Brian Warner
45adde7180 publish.py: log roothash in base32, not binary
Closes ticket:1800
2014-09-02 13:32:59 -07:00
Daira Hopwood
0ef5939477 Remove 'needs-rebalancing' and add 'count-happiness' to checker reports; repair tests. fixes #1784, #2105
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2014-03-20 16:13:57 +00:00
Daira Hopwood
7956e22d21 Include the number of remaining shares of the right version in NotEnoughSharesError messages.
Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
2013-05-14 23:20:47 +01:00
Daira Hopwood
e76281744c mutable/retrieve.py: improve comments. refs #1742
Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
2013-05-14 23:20:46 +01:00
Daira Hopwood
cf52c512c5 Raise NotEnoughSharesError if there are initially not enough shares for a mutable retrieve. refs #1742
We also change the order of setting up attributes in Retrieve so that _raise_notenoughshareserror() can be called from _setup_download.

Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
2013-05-14 23:20:46 +01:00
Daira Hopwood
a74b09ec86 mutable/retrieve.py: inline the single-use function _remove_reader.
A simple refactoring. Doesn't even require a new or updated unit test.

Author: Zooko O'Whielacronx <zooko@zooko.com>
Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
2013-05-14 23:20:46 +01:00
Brian Warner
d8c536847b Remove the whitespace reported by find-trailing-spaces. No code changes. 2013-04-09 20:04:12 +01:00
Brian Warner
4751a46840 ServerMap.copy(): deepcopy .update_data too. Closes #1785.
This was apparently unused, but good to copy for completeness. Tests
pass with and without the change.
2013-04-09 12:18:19 +01:00
David-Sarah Hopwood
4563ba456b Remove ResponseCache in favor of MDMFSlotReadProxy's cache. closes #1240.
This contains several merged patches. Individual messages follow, latest first:

* Fix a warning from check-miscaptures.
* In retrieve.py, explicitly test whether a key is in self.servermap.proxies
  rather than catching KeyError.
* Added a new comment to the MDMF version of the test I removed, explaining
  the removal of the SDMF version.
* Removed test_corrupt_all_block_hash_tree_late, since the entire block_hash_tree
  is cached in the servermap for an SDMF file.
* Fixed several tests that require files larger than the servermap cache.
* Remove unused test_response_cache_memory_leak().
* Exercise the cache.
* Test infrastructure for counting cache misses on MDMF files.
* Removed the ResponseCache. Instead, the MDMFSlotReadProxy initialized
  by ServerMap is kept around so Retrieve can access it. The ReadProxy
  has a cache of the first 1000 bytes initially read from each share by
  the ServerMap. We're able to satisfy a number of requests out of this
  cache, so roundtrips are reduced from 84 to 60 in test_deepcheck_mdmf.
  There is still some mystery about under what conditions the cache has
  fewer than 1000 bytes. Also this breaks some existing unit tests that
  depend on the inner behavior of ResponseCache.
* The servermap.proxies (a cache of SlotReadProxies) is now keyed
  by (verinfo,serverid,shnum) rather than just (serverid,shnum)
* Minor cosmetic changes
* Added a test failure if the number of cache misses is too high.

Author: Andrew Miller <amiller@dappervision.com>
Signed-off-by: David-Sarah Hopwood <davidsarah@jacaranda.org>
2012-12-27 00:00:17 +00:00
david-sarah
33e2d2962e Change the maximum mutable share size to 69105 TB, and add a maximum-mutable-share-size field to the version announcement. Includes a test. refs #1778 2012-06-22 15:43:54 +00:00
david-sarah
8c6c410b87 mutable: fix shape of 'verinfo' tuple returned from MDMFSlotWriteProxy.get_verinfo(). fixes #1669 2012-06-21 20:52:21 +00:00
david-sarah
635e87bd7b Fix a bug in mutable publish that could cause an IndexError when a writer is removed in Publish._connection_problem. This version uses DictOfSets as suggested by warner. fixes #1749 2012-06-15 03:44:37 +00:00
Brian Warner
76fca000df CheckResults: pass IServer to corrupt/incompatible share locators
Getters still return serverid. Adds temporary get_new_corrupt_shares()
and get_new_incompatible_shares().
2012-06-02 11:39:11 -07:00
Brian Warner
dd8178ee6d CheckResults: pass IServer to servers_responding=, getter returns serverid
Add temporary get_new_servers_responding().
2012-06-02 11:39:11 -07:00
Brian Warner
a4c95609c7 CheckResults: pass IServer to sharemap=, but get_sharemap() returns serverids
This changes all code which feeds CheckResults(sharemap=) to provide
IServer instances, but CheckResults converts these to old-style
serverids during output, so downstream code doesn't have to change yet.

It adds a temporary get_new_sharemap(), which *does* return IServer
instances, so the immutable repairer can build new CheckResults from an
old one. This will go away when get_sharemap() is updated to return
IServer (and downstream code is updated too).
2012-06-02 11:39:11 -07:00
Brian Warner
437de4340b CheckResults: privatize remaining attributes 2012-06-02 11:39:10 -07:00
Brian Warner
0fcc054a61 CheckResults: use fat init, add type-checking assertions
Added assertions for sharemap, servermap, servers_responding,
list_corrupt_shares, and list_incompatible_shares.
2012-06-02 11:39:10 -07:00
Brian Warner
fba26d7bae mutable/checker: refactor to make CheckResults easier to change 2012-06-02 11:39:10 -07:00
Brian Warner
ccfcd4de37 change CheckResults to use a fat set_data()
i.e. change set_data() to accept lots of parameters, instead of taking
a single dictionary with lots of keys. Also Convert all CheckResults
creators to use it.
2012-06-02 11:39:10 -07:00
david-sarah
4ddcde3094 Since we now require Python 2.5, we can use os.SEEK_END. 2012-05-16 21:39:48 +00:00
Brian Warner
470acbf1e1 servermap.py: oops, fix _done() condition, good catch by davidsarah 2012-04-01 15:10:34 -07:00
david-sarah
87ca4fc705 mutable/layout.py: improve confusing documentation of layout. fixes #1534 2011-09-14 14:39:47 +00:00
Brian Warner
5bae4a1bd2 Mutable repair: use new MODE_REPAIR to query all servers *and* get privkey
This fixes bug #1689. Repair was using MODE_READ to build the servermap,
which doesn't try hard enough to grab the privkey, and also doesn't guarantee
sending queries to all servers. This patch adds a new MODE_REPAIR which does
both, and does a separate, distinct mapupdate to start wth repair cycle,
instead of relying upon the (MODE_CHECK) mapupdate leftover from the
filecheck that triggered the repair.
2012-03-31 11:39:02 -07:00
Brian Warner
a56e639346 Fix mutable status (mapupdate/retrieve/publish) to use serverids, not tubids
This still leaves immutable-publish results incorrectly using tubids instead
of serverids. That will need some more work, since it might change the Helper
interface.
2012-03-17 17:01:35 -07:00
Kevan
1469b1b9f9 Ensure that verification proceeds and stops when appropriate.
The removed assertions are appropriate for a download that seeks to
return plaintext to a caller; if we don't have at least k active remote
shares, then we can't hope to do that. They're not appropriate for a
verification operation; a user can try to verify a file that has fewer
than k shares available, so that shouldn't be treated as an error.
Instead, we proceed with fewer than k shares, and ensure that we
terminate the download if we have no shares at all and we're verifying.
2012-01-24 12:52:09 -08:00