Commit Graph

55 Commits

Author SHA1 Message Date
Brian Warner
cc422f8dc0 stop using IURI()/etc as an adapter 2009-11-11 14:45:42 -08:00
Brian Warner
131e05b155 clean up uri-vs-cap terminology, emphasize cap instances instead of URI strings
* "cap" means a python instance which encapsulates a filecap/dircap (uri.py)
 * "uri" means a string with a "URI:" prefix
 * FileNode instances are created with (and retain) a cap instance, and
   generate uri strings on demand
 * .get_cap/get_readcap/get_verifycap/get_repaircap return cap instances
 * .get_uri/get_readonly_uri return uri strings

* add filenode.download_to_filename() for control.py, should find a better way
* use MutableFileNode.init_from_cap, not .init_from_uri
* directory URI instances: use get_filenode_cap, not get_filenode_uri
* update/cleanup bench_dirnode.py to match, add Makefile target to run it
2009-11-11 14:26:19 -08:00
Brian Warner
f47672d12a add parser for immutable directory caps: DIR2-CHK, DIR2-LIT, DIR2-CHK-Verifier 2009-11-04 10:13:51 -08:00
Brian Warner
0d5dc51617 Overhaul IFilesystemNode handling, to simplify tests and use POLA internally.
* stop using IURI as an adapter
* pass cap strings around instead of URI instances
* move filenode/dirnode creation duties from Client to new NodeMaker class
* move other Client duties to KeyGenerator, SecretHolder, History classes
* stop passing Client reference to dirnode/filenode constructors
  - pass less-powerful references instead, like StorageBroker or Uploader
* always create DirectoryNodes by wrapping a filenode (mutable for now)
* remove some specialized mock classes from unit tests

Detailed list of changes (done one at a time, then merged together)

always pass a string to create_node_from_uri(), not an IURI instance
always pass a string to IFilesystemNode constructors, not an IURI instance
stop using IURI() as an adapter, switch on cap prefix in create_node_from_uri()
client.py: move SecretHolder code out to a separate class
test_web.py: hush pyflakes
client.py: move NodeMaker functionality out into a separate object
LiteralFileNode: stop storing a Client reference
immutable Checker: remove Client reference, it only needs a SecretHolder
immutable Upload: remove Client reference, leave SecretHolder and StorageBroker
immutable Repairer: replace Client reference with StorageBroker and SecretHolder
immutable FileNode: remove Client reference
mutable.Publish: stop passing Client
mutable.ServermapUpdater: get StorageBroker in constructor, not by peeking into Client reference
MutableChecker: reference StorageBroker and History directly, not through Client
mutable.FileNode: removed unused indirection to checker classes
mutable.FileNode: remove Client reference
client.py: move RSA key generation into a separate class, so it can be passed to the nodemaker
move create_mutable_file() into NodeMaker
test_dirnode.py: stop using FakeClient mockups, use NoNetworkGrid instead. This simplifies the code, but takes longer to run (17s instead of 6s). This should come down later when other cleanups make it possible to use simpler (non-RSA) fake mutable files for dirnode tests.
test_mutable.py: clean up basedir names
client.py: move create_empty_dirnode() into NodeMaker
dirnode.py: get rid of DirectoryNode.create
remove DirectoryNode.init_from_uri, refactor NodeMaker for customization, simplify test_web's mock Client to match
stop passing Client to DirectoryNode, make DirectoryNode.create_with_mutablefile the normal DirectoryNode constructor, start removing client from NodeMaker
remove Client from NodeMaker
move helper status into History, pass History to web.Status instead of Client
test_mutable.py: fix minor typo
2009-08-15 04:28:46 -07:00
Brian Warner
531cc7899f rename NewDirectoryNode to DirectoryNode, NewDirectoryURI to DirectoryURI 2009-07-17 17:15:49 -05:00
Brian Warner
d8ba8c2eb5 Allow tests to pass with -OO by turning some AssertionErrors (the ones that
we actually exercise during tests) into more specific exceptions, so they
don't get optimized away. The best rule to follow is probably this: if an
exception is worth testing, then it's part of the API, and AssertionError
should never be part of the API. Closes #749.
2009-07-14 23:45:10 -07:00
Brian Warner
ef1b6ae8e3 Tolerate unknown URI types in directory structures. Part of #683.
The idea is that future versions of Tahoe will add new URI types that this
version won't recognize, but might store them in directories that we *can*
read. We should handle these "objects from the future" as best we can.
Previous releases of Tahoe would just explode. With this change, we'll
continue to be able to work with everything else in the directory.

The code change is to wrap anything we don't recognize as an UnknownNode
instance (as opposed to a FileNode or DirectoryNode). Then webapi knows how
to render these (mostly by leaving fields blank), deep-check knows to skip
over them, deep-stats counts them in "count-unknown". You can rename and
delete these things, but you can't add new ones (because we wouldn't know how
to generate a readcap to put into the dirnode's rocap slot, and because this
lets us catch typos better).
2009-07-02 18:07:49 -07:00
Brian Warner
ef53da2b12 break storage.py into smaller pieces in storage/*.py . No behavioral changes. 2009-02-18 14:46:55 -07:00
Brian Warner
b77a017872 uri: add abbrev_si() method, which returns the abbreviated storage index 2009-01-30 19:31:10 -07:00
Zooko O'Whielacronx
2e762f39f6 immutable: define a new interface IImmutableFileURI and declare that CHKFileURI and LiteralFileURI provide it 2009-01-07 12:24:51 -07:00
Zooko O'Whielacronx
8e48a0eeef uri: generalize regexp that recognizes tahoe URLs to work for any host and port 2008-12-16 17:49:30 -07:00
Zooko O'Whielacronx
c456ff8591 rename "get_verifier()" to "get_verify_cap()" 2008-12-08 12:44:11 -07:00
Zooko O'Whielacronx
fe6abac87b wui/wapi: change the default port number from 8123 to 3456 to avoid conflict with TorButton
See ticket #536 for details.
2008-11-25 17:57:37 -07:00
Brian Warner
0d93d6244e CLI: add 'tahoe manifest', which takes a directory and returns a list of things you can reach from it 2008-11-12 20:17:25 -07:00
Zooko O'Whielacronx
fa302544fa immutable: refactor immutable filenodes and comparison thereof
* the two kinds of immutable filenode now have a common base class
* they store only an instance of their URI, not both an instance and a string
* they delegate comparison to that instance
2008-09-23 11:52:49 -07:00
Brian Warner
95a085763f uri.py: get 100% test coverage, fix a few bugs in the process 2008-03-04 14:27:45 -07:00
Brian Warner
6d7417c0bf uri.py: hush pyflakes warning 2008-02-14 19:45:12 -07:00
Zooko O'Whielacronx
7c6de95bc6 switch from base62 to base32 for storage indices, switch from z-base-32 to rfc 3548 base-32 for everything, separate out base32 encoding from idlib 2008-02-14 19:27:47 -07:00
Zooko O'Whielacronx
3f8df27063 use base62 encoding for storage indexes, on disk and in verifier caps, and in logging and diagnostic tools
base62 encoding fits more information into alphanumeric chars while avoiding the troublesome non-alphanumeric chars of base64 encoding.  In particular, this allows us to work around the ext3 "32,000 entries in a directory" limit while retaining the convenient property that the intermediate directory names are leading prefixes of the storage index file names.
2008-02-12 20:48:37 -07:00
Brian Warner
e92a2b5ab2 dump-cap: include UEB_hash in output 2008-02-06 12:48:19 -07:00
Zooko O'Whielacronx
1d1628e525 rename storage_index_chk_hash() to storage_index_hash() and add TODO about how our use of it now includes keys that are not CHKs 2008-02-01 12:27:37 -07:00
robk-tahoe
d87a80dca6 added is_uri() function to allmydata.uri 2008-01-10 20:43:42 -07:00
Zooko O'Whielacronx
ab4303609d cmdline: give useful error messages about the --dir-uri and ~/.tahoe/private/root_dir.cap 2008-01-03 17:35:35 -07:00
Zooko O'Whielacronx
eb373c0001 add human-encodings of caps, refactor encodings of caps, tighten checks, fix unit tests to use values of the right size 2008-01-03 16:55:43 -07:00
Zooko O'Whielacronx
eae499539d refactor constructing URI objects from strings and add human-encoding of WriteableSSKFileURI 2008-01-02 22:12:15 -07:00
Brian Warner
318b63fbc7 hush pyflakes 2007-12-18 18:37:22 -07:00
Zooko O'Whielacronx
a5a54ac5ca remove the DirnodeURI foolscap schema and mv those regexes into uri.py
We currently do not pass dirnode uris over foolscap.
2007-12-18 17:44:24 -07:00
Zooko O'Whielacronx
9848d2043d make more precise regexp for WriteableSSKFileURI and DirnodeURI and use it in unit tests
Also allow an optional leading "http://127.0.0.1:8123/uri/".
Also fix a few unit tests to generate bogus Dirnode URIs of the modern form instead of the former form.
2007-12-18 13:15:08 -07:00
Brian Warner
bf1b7d78e2 uri.py: improve test coverage 2007-12-04 17:38:31 -07:00
Brian Warner
cf2bd03813 remove most (maybe all?) traces of old Dirnode class. Yay for negative code days. 2007-12-04 17:00:58 -07:00
Zooko O'Whielacronx
59d6c3c822 decentralized directories: integration and testing
* use new decentralized directories everywhere instead of old centralized directories
 * provide UI to them through the web server
 * provide UI to them through the CLI
 * update unit tests to simulate decentralized mutable directories in order to test other components that rely on them
 * remove the notion of a "vdrive server" and a client thereof
 * remove the notion of a "public vdrive", which was a directory that was centrally published/subscribed automatically by the tahoe node (you can accomplish this manually by making a directory and posting the URL to it on your web site, for example)
 * add a notion of "wait_for_numpeers" when you need to publish data to peers, which is how many peers should be attached before you start.  The default is 1.
 * add __repr__ for filesystem nodes (note: these reprs contain a few bits of the secret key!)
 * fix a few bugs where we used to equate "mutable" with "not read-only".  Nowadays all directories are mutable, but some might be read-only (to you).
 * fix a few bugs where code wasn't aware of the new general-purpose metadata dict the comes with each filesystem edge
 * sundry fixes to unit tests to adjust to the new directories, e.g. don't assume that every share on disk belongs to a chk file.
2007-12-03 14:52:42 -07:00
Brian Warner
f1c3ff62c1 mutable: improve NewDirectoryNode test coverage 2007-11-01 18:35:54 -07:00
Brian Warner
1d8a4cdfe7 mutable: first pass at dirnodes, filenodes, new URIs. Some test coverage.
The URI typenames need revision, and only a few dirnode methods are
implemented. Filenodes are non-functional, but URI/key-management is in
place. There are a lot of classes with names like "NewDirectoryNode" that
will need to be rename once we decide what (if any) backwards compatibility
want to retain.
2007-11-01 15:15:29 -07:00
Brian Warner
9da1d70676 add a simple checker, for both files and directories 2007-10-15 16:16:39 -07:00
Brian Warner
311ed144f8 uri.py: improve test coverage a bit 2007-09-17 01:09:47 -07:00
Brian Warner
9c5ab89afe truncate storage index to 128 bits, since it's derived from a 128 bit AES key 2007-07-22 19:48:44 -07:00
Brian Warner
81a9904455 CHK: remove the storage index from the URI, deriving it from the key instead 2007-07-21 18:23:15 -07:00
Brian Warner
2bc3c163b6 uri.py: get keys and index from the URI instance 2007-07-21 17:45:00 -07:00
Brian Warner
1d9a58977f uri: implement URI-processing classes, IFileURI/IDirnodeURI, use internally 2007-07-21 15:40:36 -07:00
Brian Warner
ba7e14a870 fix several methods to handle LIT URIs correctly, rather than assuming that all filenodes are CHK URIs 2007-07-12 16:17:49 -07:00
Brian Warner
def63d193e implement URI:LIT, which stores small (<55B) files inside the URI itself. Fixes #81. 2007-07-12 13:22:36 -07:00
Brian Warner
62e8528cc6 web: /uri/ must escape slashes, we use bangs for this 2007-07-07 22:06:52 -07:00
Brian Warner
fb02488a8e vdrive: switch to URI:DIR and URI:DIR-RO, providing transitive readonlyness 2007-06-25 13:23:51 -07:00
Brian Warner
e0dfedb0a6 add 'allmydata-tahoe dump-uri-extension' utility command 2007-06-11 18:38:21 -07:00
Brian Warner
382888899b refactor URI_extension handlers out of encode/download and into uri.py 2007-06-11 18:25:18 -07:00
Brian Warner
c9ef291c02 rename thingA to 'uri extension' 2007-06-08 15:59:16 -07:00
Brian Warner
c049941529 move almost all hashing to SHA256, consolidate into hashutil.py
The only SHA-1 hash that remains is used in the permutation of nodeids,
where we need to decide if we care about performance or long-term security.
I suspect that we could use a much weaker hash (and faster) hash for
this purpose. In the long run, we'll be doing thousands of such hashes
for each file uploaded or downloaded (one per known peer).
2007-06-07 21:47:21 -07:00
Brian Warner
3dfd26970b move validation data to thingA, URI has storage_index plus thingA hash
This (compatibility-breaking) change moves much of the validation data and
encoding parameters out of the URI and into the so-called "thingA" block
(which will get a better name as soon as we find one we're comfortable with).
The URI retains the "storage_index" (a generalized term for the role that
we're currently using the verifierid for, the unique index for each file
that gets used by storage servers to decide which shares to return), the
decryption key, the needed_shares/total_shares counts (since they affect
peer selection), and the hash of the thingA block.

This shortens the URI and lets us add more kinds of validation data without
growing the URI (like plaintext merkle trees, to enable strong incremental
plaintext validation), at the cost of maybe 150 bytes of alacrity. Each
storage server holds an identical copy of the thingA block.

This is an incompatible change: new messages have been added to the storage
server interface, and the URI format has changed drastically.
2007-06-01 18:48:01 -07:00
Brian Warner
05163ec8e1 change uri-packer-unpacker to deal with dictionaries, not fragile tuples 2007-05-23 11:18:49 -07:00
Brian Warner
4b2298937b use real encryption, generate/store/verify verifierid and fileid 2007-04-25 17:53:10 -07:00