storage servers.
"""
- def upload_from_file_to_uri(filename=str,
- convergence=ChoiceOf(None,
- StringConstraint(2**20))):
- """Upload a file to the grid. This accepts a filename (which must be
- absolute) that points to a file on the node's local disk. The node will
- read the contents of this file, upload it to the grid, then return the
- URI at which it was uploaded. If convergence is None then a random
- encryption key will be used, else the plaintext will be hashed, then
- that hash will be mixed together with the "convergence" string to form
- the encryption key.
- """
- return URI
-
- def download_from_uri_to_file(uri=URI, filename=str):
- """Download a file from the grid, placing it on the node's local disk
- at the given filename (which must be absolute[?]). Returns the
- absolute filename where the file was written."""
- return str
-
# debug stuff
def get_memory_usage():
from allmydata.util import idlib, mathutil
from allmydata.util import log, base32
from allmydata.util.verlib import NormalizedVersion
-from allmydata.util.encodingutil import quote_output, unicode_to_argv, get_filesystem_encoding
+from allmydata.util.encodingutil import quote_output, unicode_to_argv
from allmydata.util.fileutil import abspath_expanduser_unicode
from allmydata.util.consumer import MemoryConsumer, download_to_data
from allmydata.scripts import runner
d.addCallback(self._test_control2, control_furl_file)
return d
def _test_control2(self, rref, filename):
- d = rref.callRemote("upload_from_file_to_uri",
- filename.encode(get_filesystem_encoding()), convergence=None)
- downfile = os.path.join(self.basedir, "control.downfile").encode(get_filesystem_encoding())
- d.addCallback(lambda uri:
- rref.callRemote("download_from_uri_to_file",
- uri, downfile))
- def _check(res):
- self.failUnlessEqual(res, downfile)
- data = open(downfile, "r").read()
- expected_data = open(filename, "r").read()
- self.failUnlessEqual(data, expected_data)
- d.addCallback(_check)
+ d = defer.succeed(None)
d.addCallback(lambda res: rref.callRemote("speed_test", 1, 200, False))
if sys.platform in ("linux2", "linux3"):
d.addCallback(lambda res: rref.callRemote("get_memory_usage"))