Commit Graph

5536 Commits

Author SHA1 Message Date
Brian Warner
08f5bc8e2f convert UploadResults to a fat init
Populate most of UploadResults (except .uri, which is learned later when
using a Helper) in the constructor, instead of allowing creators to
write to attributes later. This will help isolate the fields that we
want to change to use IServers.
2012-05-21 21:14:14 -07:00
Brian Warner
b71234c538 add HelperUploadResults
This splits the pb.Copyable on-wire object (HelperUploadResults) out
from the local results object (UploadResults). To maintain compatibility
with older Helpers, we have to leave pb.Copyable classes alone and
unmodified, but we want to change UploadResults to use IServers instead
of serverids. So by using a different class on the wire, and translating
to/from it on either end, we can accomplish both.
2012-05-21 21:14:00 -07:00
Brian Warner
b3af012b13 Uploader cleanup: create results at end, not beginning
This will make it easier to populate the UploadResults during __init__,
instead of doing it one-field-at-a-time later.
2012-05-21 21:13:47 -07:00
Brian Warner
0df833eac9 clean up Helper to make later changes easier
Fix up control flow inside the Helper, to make it more friendly for
later refactoring.
2012-05-21 21:13:32 -07:00
Brian Warner
e60982c851 helper: remove timings["existence_check"], aka "Already-In-Grid Check"
This measured how long the Helper took to do a filecheck before asking
for ciphertext. The "Contacting Helper" report includes both
existence_check and the client-helper RTT.

For non-overlapping uploads, it was being returned correctly. But when
multiple upload requests overlapped, and the file was not already in the
grid, the filecheck would only run once, and its existence_check time
would be reported for all uploaders (even if they didn't have to wait
for that time). Cleaning that up proved too difficult: the only correct
place to report this time is from the initial remote_upload_chk() call,
but the return value of that is too constrained to accomodate it in the
needs-upload case.

So I'm removing it altogether. Eventually I plan to add a proper
events/times field and record more data, including this check, in a form
that can be drawn on a nice zoomable timeline view.

Old clients talking to a new Helper (which doesn't supply the value)
will tolerate the loss (they'll just display an empty field on the web
view).
2012-05-21 21:13:11 -07:00
Brian Warner
393c0729de test_checker: minor improvement in fake-server setup
This prepares for testing the differences between tubid and pubkey-based
name/longname.
2012-05-21 19:49:36 -07:00
david-sarah
f19620301e docs/frontends/FTP-and-SFTP.rst: remove outdated allmydata.com reference. fixes #1743 2012-05-18 22:56:18 +00: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
david-sarah
a1a1b5bf8a Simplifications resulting from requiring Python 2.5 and therefore being able to use sqlite3 from the standard library. This also drops sqlite3 from the set of versions and paths we report. 2012-05-16 02:47:25 +00:00
david-sarah
0fc196ea5f Require Python 2.5. 2012-05-16 02:41:49 +00:00
david-sarah
97d6a162e0 misc/build_helpers/check-interfaces.py: avoid spurious warnings about ignored exceptions on shutdown. Also make the check function able to write errors to an arbitrary stream. 2012-05-18 02:12:52 +00:00
Brian Warner
cc366903ce dictutil.DictOfSets: remove .union() method, it was misleading
Unlike set.union(), which returns a new set, DictOfSets.union() modified
the DictOfSets in-place. The name collision bit me when I changed some
code from using DictOfSets to a normal set, and expected that
set.union() would modify the set in-place. Since there was only one user
of DictOfSets.union, I figured it was safer to just get rid of it.
2012-05-16 16:55:09 -07:00
Brian Warner
9acf5beebd immutable repairer: populate servers-responding properly
If a server did not respond to the pre-repair filecheck, but did respond
to the repair, that server was not correctly added to the
RepairResults.data["servers-responding"] list. (This resulted from a
buggy usage of DictOfSets.union() in filenode.py).

In addition, servers to which filecheck queries were sent, but did not
respond, were incorrectly added to the servers-responding list
anyawys. (This resulted from code in the checker.py not paying attention
to the 'responded' flag).

The first bug was neatly masked by the second: it's pretty rare to have
a server suddenly start responding in the one-second window between a
filecheck and a subsequent repair, and if the server was around for the
filecheck, you'd never notice the problem. I only spotted the smelly
code while I was changing it for IServer cleanup purposes.

I added coverage to test_repairer.py for this. Trying to get that test
to fail before fixing the first bug is what led me to discover the
second bug. I also had to update test_corrupt_file_verno, since it was
incorrectly asserting that 10 servers responded, when in fact one of
them throws an error (but the second bug was causing it to be reported
anyways).
2012-05-16 16:55:09 -07:00
david-sarah
5ec20761ed Update my (davidsarah) gpg fingerprint in CREDITS. Mwahaha! :-) 2012-05-16 23:15:26 +00:00
david-sarah
3738c3e2d1 fileutil.py: use try/finally to close file in write_atomically. 2012-05-16 23:08:39 +00:00
david-sarah
959248cd49 Change logging.rst to address warner's review comment. refs #1693 2012-05-16 22:13:29 +00:00
Brian Warner
c4d7b7b109 write node.url and portnum files atomically, to fix race in test_runner
Previously, test_runner sometimes fails because the _node_has_started()
poller fires after the portnum file has been opened, but before it has
actually been filled, allowing the test process to observe an empty file,
which flunks the test.

This adds a new fileutil.write_atomically() function (using the usual
write-to-.tmp-then-rename approach), and uses it for both node.url and
client.port . These files are written a bit before the node is really up and
running, but they're late enough for test_runner's purposes, which is to know
when it's safe to read client.port and use 'tahoe restart' (and therefore
SIGINT) to restart the node.

The current node/client code doesn't offer any better "are you really done
with startup" indicator.. the ideal approach would be to either watch the
logfile, or connect to its flogport, but both are a hassle. Changing the node
to write out a new "all done" file would be intrusive for regular
operations.
2012-05-14 15:03:14 -07:00
david-sarah
bf7e351464 Improve a comment in __init__.py. 2012-05-14 16:34:31 +00:00
david-sarah
4b80299fdd Suppress the PowmInsecureWarning from PyCrypto. refs #1586 2012-05-14 03:23:52 +00:00
david-sarah
1e2657efe3 Clarify an ambiguity about which version number is meant in quickstart.rst. 2012-05-14 00:26:37 +00:00
Brian Warner
e850b54772 performance.rst: small updates, mention (lack of) MDMF
refs #1398
2012-05-13 14:07:39 -07:00
Brian Warner
6856e53b36 CREDITS: add amiller, zooko, rearrange a bit 2012-05-13 10:32:17 -07:00
Brian Warner
fcc7e64759 Doc updates and cosmetic fixes for #1115 patch.
Removes the caveat from webapi.txt about count-good-share-hosts being wrong.

This series should close #1115.
2012-05-13 01:15:50 -07:00
Andrew Miller
04eb6086ad Fixed an error in previous commit where an empty servermap would throw an exception in 'count-good-share-hosts'. Augmented unit test.
Signed-off-by: Andrew Miller <amiller@dappervision.com>
2012-05-13 00:59:30 -07:00
Andrew Miller
4b7f34d179 Added tests for count-good-share-hosts under check and repair conditions. Patched the incorrect computation in immutable/filenode.py
Signed-off-by: Andrew Miller <amiller@dappervision.com>

Fixed missing import statements

Signed-off-by: Andrew Miller <amiller@dappervision.com>
2012-05-13 00:59:30 -07:00
Brian Warner
8f630a76fe test_web: fix use of headers= that's been wrong for a while 2012-05-13 00:45:12 -07:00
Brian Warner
5d404db898 webapi: don't allow ETags in t=info or t=rename-form, both are variable
t=info contains randomly-generated ophandles, and t=rename-form contains the
name of the child being renamed, so neither is eligible for a
short-circuiting ETag. Enhanced test_web to exercise this. Had to improve
FakeCHKFileNode slightly to let it participate. Refs #443.
2012-05-13 00:45:11 -07:00
Brian Warner
d437a9b33e test_web: improve ETag tests, add If-None-Match test 2012-05-13 00:45:11 -07:00
Andrew Miller
16eddc35e8 Added unit tests covering #466:comment-15. Refactored the 'etag' behavior for immutable files to respond to all GET '?t=' flags, not just t=None
Signed-off-by: Andrew Miller <amiller@dappervision.com>
2012-05-13 00:45:11 -07:00
Jeremy Fitzhardinge
4f1bc1b387 Short circuit GET on ETags match
When client does a conditional GET/HEAD with If-none-match:, if the condition
fails (ie, the client's ETag matches the file's) then we can short-circuit
the whole process and immediately return an empty body.
2012-05-13 00:45:11 -07:00
Jeremy Fitzhardinge
518ef25bdb Add ETags for immutable directories
Like immutable files, the ETag is based on the storage index. However, since
a directory is a special interpretation of a file, it is distinguished from
the file by prepending "DIR:" onto the start of the ETag, and adding
-representation on the end (where -representation is the ?t= argument, json,
info, etc).

It also checks the return of setETag and avoids generating a representation
if the client already has it.
2012-05-13 00:45:11 -07:00
Brian Warner
488b6f8ccd test-dont-use-too-old-dep.py: fix tarfile timestamps
It turns out that TarFile.addfile() doesn't provide a reasonable default
timestamp, resulting in files dated to 1970 (they're probably wearing
bell-bottoms and listening to disco too). Then, when the bdist_egg command
tries to create a *zip*file with those files, it explodes because zipfiles
cannot handle timestamps before 1980 (it prefers boomboxes and jackets with
straps on the shoulders, thank you very much).

This puts a modern time.time() on the members of the tarfile, allowing future
cryptocoderarchaeologists the opportunity to make fun of fashion trends from
the user's chosen era, rather than an artificially older one.

refs #1342
2012-05-12 23:34:03 -07:00
david-sarah
379901bf8f Add 'tahoe debug flogtool' command, test for --help, and docs. This version gets the help synopses more correct, and changes the doc to say that this command is added in 1.10.0 rather than 1.9.2. fixes #1693 2012-03-31 22:41:22 +00:00
Zooko
d867765604 modify build_helpers files
Should close #1342. This makes the actual changes to the two test
files (separated from the 'rename' patch to avoid VC complications).
2012-05-12 20:47:24 -07:00
Zooko
533e4bc813 rename build_helpers files
This is from the darcs patch for #1342, which failed to apply on my darcs
tree, so I'm landing it from git. I'm landing the rename-files part
separately from the modify-those-files part to avoid VC complications.
2012-05-12 20:47:01 -07:00
Brian Warner
eb2a4ef246 webapi: remove undocumented t=mkdir-p operation
Closes #380
2012-05-12 19:19:43 -07:00
Brian Warner
2c5a7f7ba4 Improve webapi t=move docs. 2012-05-09 16:46:53 -07:00
Brian Warner
8417579147 webui: merge 'move' form with 'rename' form 2012-05-09 14:21:37 -07:00
Brian Warner
81c30b1cd1 test_web: improve shouldFail2() error reporting 2012-05-09 14:18:37 -07:00
Brian Warner
a92385b54b webapi 'move'-button cleanups
test_web.py: use shouldFail2(), safer than old shouldFail()
directory.py: forbid slashes in from_name=, return BAD_REQUEST instead of
              GONE when trying to move into a non-directory
2012-05-09 14:18:27 -07:00
Marcus Wanner
e89bce21a5 Add unit test for moving a directory
My gut tells me this case sould be tested. The rename suite tests it, so
move's will too.
2012-05-09 13:07:14 -07:00
Marcus Wanner
e58a01270b Change the arbitrary URI support from implied to explicit
The move webapi function now takes a target_type argument which lets it
know whether the target is a subdirectory name or URI. This is an
improvement over the old system in which the move handler tried to guess
whether the target was a name or a URI. Also fixed a little docs
copypaste problem and tweaked some line wrapping.
2012-05-09 13:07:14 -07:00
Marcus Wanner
b29d0920d3 Adding 'move' button to web UI, closes #1579
This adds "move file" capability to the web UI's directory display. The
support and test framework is heavily based on the similar "rename file"
feature. Unit tests and documentation are included. Multiple in-progress
versions of this patch may be found in ticket 1579. This version
includes arbitrary URI target support and is compatible with the change
from tahoe_css to tahoe.css.
2012-05-09 13:07:13 -07:00
Zooko O'Whielacronx
8aa690b64e CREDITS: lebek 2012-05-03 17:30:33 +00:00
david-sarah
a555336910 Make sure that foolscap.logging.log.setLogDir is called with a str (not unicode) path, v2. Includes test. fixes #1725 2012-04-29 02:28:44 +00:00
Brian Warner
842a3a132b introweb announcements: show serverid, not tubid
'serverid' is the pubkey (for V2 clients), falling back to the tubid (for V1
clients). This also required cleaning up the way the index is created for the
old V1 introducer.
2012-04-24 01:37:28 -04:00
Brian Warner
84c9f3bfb4 Fix introweb display for mixed V1/V2 clients. Closes #1721.
This significantly cleans up the IntroducerServer web-status renderers.
Instead of poking around in the introducer's internals, now the web-status
renderers get clean AnnouncementDescriptor and SubscriberDescriptor
objects. They are still somewhat foolscap-centric, but will provide a clean
abstraction boundary for future improvements.

The specific #1721 bug was that old (V1) subscribers were handled by
wrapping their RemoteReference in a special WrapV1SubscriberInV2Interface
object, but the web-status display was trying to peek inside the object to
learn what host+port it was associated with, and the wrapper did not proxy
those extra attributes.

A test was added to test_introducer to make sure the introweb page renders
properly and at least contains the nicknames of both the V1 and V2 clients.
2012-04-23 18:30:53 -04:00
Patrick R McDonald
080c136daf Updated webapi.rst to list /cap as a synonym for /uri 2012-04-17 11:41:11 -07:00
markus reichelt
711edb2b6e Adding jg71 to CREDITS 2012-04-14 16:01:07 +02:00
Patrick R McDonald
589179cf03 Fix for ticket #1662 2012-04-10 11:33:14 -07:00