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
This commit is contained in:
Brian Warner
2009-11-11 14:25:42 -08:00
parent f47672d12a
commit 131e05b155
16 changed files with 214 additions and 176 deletions

View File

@ -271,12 +271,15 @@ class DirectoryNode:
def get_readonly_uri(self):
return self._uri.get_readonly().to_string()
def get_cap(self):
return self._uri
def get_readcap(self):
return self._uri.get_readonly()
def get_verify_cap(self):
return self._uri.get_verify_cap()
def get_repair_cap(self):
if self._node.is_readonly():
return None
return None # readonly (mutable) dirnodes are not yet repairable
return self._uri
def get_storage_index(self):