From: Brian Warner Date: Wed, 13 Dec 2006 22:14:20 +0000 (-0700) Subject: move debugshell.py into allmydata/ X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~437 X-Git-Url: https://git.rkrishnan.org/(%5B%5E?a=commitdiff_plain;h=d9dcf5f098939a8d5e1822c10e9c1543d349b781;p=tahoe-lafs%2Ftahoe-lafs.git move debugshell.py into allmydata/ --- diff --git a/allmydata/debugshell.py b/allmydata/debugshell.py new file mode 100644 index 00000000..130c9099 --- /dev/null +++ b/allmydata/debugshell.py @@ -0,0 +1,17 @@ +import os + +def get_random_bucket_on(nodeid, size=200): + d = app.get_remote_service(nodeid, 'storageserver') + def get_bucket(rss): + return rss.callRemote('allocate_bucket', + verifierid=os.urandom(20), + bucket_num=26, + size=size, + leaser=app.tub.tubID, + ) + d.addCallback(get_bucket) + return d + +def write_to_bucket(bucket, bytes=100): + return bucket.callRemote('write', data=os.urandom(bytes)) + diff --git a/allmydata/manhole.py b/allmydata/manhole.py index 3926a2b7..c0858dc9 100644 --- a/allmydata/manhole.py +++ b/allmydata/manhole.py @@ -140,7 +140,7 @@ class _BaseManhole(service.MultiService): def makeNamespace(): # close over 'self' so we can get access to .parent later - import debugshell + from allmydata import debugshell debugshell.app = self.parent # make client/queen accesible via 'app' namespace = {} for sym in dir(debugshell): diff --git a/debugshell.py b/debugshell.py deleted file mode 100644 index 130c9099..00000000 --- a/debugshell.py +++ /dev/null @@ -1,17 +0,0 @@ -import os - -def get_random_bucket_on(nodeid, size=200): - d = app.get_remote_service(nodeid, 'storageserver') - def get_bucket(rss): - return rss.callRemote('allocate_bucket', - verifierid=os.urandom(20), - bucket_num=26, - size=size, - leaser=app.tub.tubID, - ) - d.addCallback(get_bucket) - return d - -def write_to_bucket(bucket, bytes=100): - return bucket.callRemote('write', data=os.urandom(bytes)) -