mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 21:17:54 +00:00
switch all foolscap imports to use foolscap.api or foolscap.logging
This commit is contained in:
parent
5d04c5b601
commit
c9803d5217
@ -136,12 +136,12 @@ def get_package_versions_and_locations():
|
||||
# because there are a few dependencies that are outside setuptools's ken (Python and
|
||||
# platform), and because setuptools might fail to find something even though import finds
|
||||
# it:
|
||||
import OpenSSL, allmydata, foolscap, nevow, platform, pycryptopp, setuptools, simplejson, twisted, zfec, zope.interface
|
||||
import OpenSSL, allmydata, foolscap.api, nevow, platform, pycryptopp, setuptools, simplejson, twisted, zfec, zope.interface
|
||||
|
||||
d1 = {
|
||||
'pyOpenSSL': (OpenSSL.__version__, os.path.dirname(OpenSSL.__file__)),
|
||||
'allmydata-tahoe': (allmydata.__version__, os.path.dirname(allmydata.__file__)),
|
||||
'foolscap': (foolscap.__version__, os.path.dirname(foolscap.__file__)),
|
||||
'foolscap': (foolscap.api.__version__, os.path.dirname(foolscap.__file__)),
|
||||
'Nevow': (nevow.__version__, os.path.dirname(nevow.__file__)),
|
||||
'pycryptopp': (pycryptopp.__version__, os.path.dirname(pycryptopp.__file__)),
|
||||
'setuptools': (setuptools.__version__, os.path.dirname(setuptools.__file__)),
|
||||
|
@ -5,7 +5,7 @@ from allmydata import node
|
||||
from zope.interface import implements
|
||||
from twisted.internet import reactor
|
||||
from twisted.application.internet import TimerService
|
||||
from foolscap import Referenceable
|
||||
from foolscap.api import Referenceable
|
||||
from foolscap.logging import log
|
||||
from pycryptopp.publickey import rsa
|
||||
|
||||
|
@ -3,7 +3,7 @@ import os, time
|
||||
from zope.interface import implements
|
||||
from twisted.application import service
|
||||
from twisted.internet import defer
|
||||
from foolscap import Referenceable
|
||||
from foolscap.api import Referenceable
|
||||
from allmydata.interfaces import RIControlClient
|
||||
from allmydata.util import fileutil, mathutil
|
||||
from allmydata.immutable import upload, download
|
||||
|
@ -3,7 +3,7 @@ import os, time, math
|
||||
|
||||
from zope.interface import implements
|
||||
from twisted.internet import defer
|
||||
from foolscap.eventual import fireEventually
|
||||
from foolscap.api import fireEventually
|
||||
import simplejson
|
||||
from allmydata.mutable.common import NotMutableError
|
||||
from allmydata.mutable.filenode import MutableFileNode
|
||||
|
@ -28,7 +28,7 @@ import allmydata
|
||||
#import amdicon
|
||||
import amdlogo
|
||||
|
||||
import foolscap
|
||||
from foolscap.api import Tub
|
||||
from twisted.python import usage
|
||||
|
||||
class AuthError(Exception):
|
||||
@ -124,7 +124,7 @@ def write_root_cap(root_cap):
|
||||
def get_nodeid():
|
||||
CERTFILE = "node.pem"
|
||||
certfile = os.path.join(get_basedir(), "private", CERTFILE)
|
||||
tub = foolscap.Tub(certFile=certfile)
|
||||
tub = Tub(certFile=certfile)
|
||||
return tub.getTubID()
|
||||
|
||||
def get_nickname():
|
||||
|
@ -1,4 +1,4 @@
|
||||
from foolscap import DeadReferenceError
|
||||
from foolscap.api import DeadReferenceError
|
||||
from twisted.internet import defer
|
||||
from allmydata import hashtree
|
||||
from allmydata.check_results import CheckResults
|
||||
|
@ -3,8 +3,7 @@ from zope.interface import implements
|
||||
from twisted.internet import defer
|
||||
from twisted.internet.interfaces import IPushProducer, IConsumer
|
||||
from twisted.application import service
|
||||
from foolscap import DeadReferenceError
|
||||
from foolscap.eventual import eventually
|
||||
from foolscap.api import DeadReferenceError, eventually
|
||||
|
||||
from allmydata.util import base32, deferredutil, hashutil, log, mathutil
|
||||
from allmydata.util.assertutil import _assert, precondition
|
||||
|
@ -3,7 +3,7 @@
|
||||
import time
|
||||
from zope.interface import implements
|
||||
from twisted.internet import defer
|
||||
from foolscap import eventual
|
||||
from foolscap.api import fireEventually
|
||||
from allmydata import uri
|
||||
from allmydata.storage.server import si_b2a
|
||||
from allmydata.hashtree import HashTree
|
||||
@ -220,7 +220,7 @@ class Encoder(object):
|
||||
}
|
||||
self._start_total_timestamp = time.time()
|
||||
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
|
||||
d.addCallback(lambda res: self.start_all_shareholders())
|
||||
|
||||
@ -278,7 +278,7 @@ class Encoder(object):
|
||||
# consistency will cause objects to live for longer than you might
|
||||
# normally expect.
|
||||
|
||||
return eventual.fireEventually(res)
|
||||
return fireEventually(res)
|
||||
|
||||
|
||||
def start_all_shareholders(self):
|
||||
|
@ -4,7 +4,7 @@ from zope.interface import implements
|
||||
from twisted.internet import defer
|
||||
from twisted.internet.interfaces import IPushProducer, IConsumer
|
||||
from twisted.protocols import basic
|
||||
from foolscap.eventual import eventually
|
||||
from foolscap.api import eventually
|
||||
from allmydata.interfaces import IFileNode, IFileURI, ICheckable, \
|
||||
IDownloadTarget, IUploadResults
|
||||
from allmydata.util import dictutil, log, base32
|
||||
|
@ -3,8 +3,7 @@ import os, stat, time, weakref
|
||||
from zope.interface import implements
|
||||
from twisted.application import service
|
||||
from twisted.internet import defer
|
||||
from foolscap import Referenceable, DeadReferenceError
|
||||
from foolscap.eventual import eventually
|
||||
from foolscap.api import Referenceable, DeadReferenceError, eventually
|
||||
import allmydata # for __full_version__
|
||||
from allmydata import interfaces, uri
|
||||
from allmydata.storage.server import si_b2a
|
||||
|
@ -3,8 +3,7 @@ from zope.interface import implements
|
||||
from twisted.python import failure
|
||||
from twisted.internet import defer
|
||||
from twisted.application import service
|
||||
from foolscap import Referenceable, Copyable, RemoteCopy
|
||||
from foolscap import eventual
|
||||
from foolscap.api import Referenceable, Copyable, RemoteCopy, fireEventually
|
||||
|
||||
from allmydata.util.hashutil import file_renewal_secret_hash, \
|
||||
file_cancel_secret_hash, bucket_renewal_secret_hash, \
|
||||
@ -529,7 +528,7 @@ class EncryptAnUploadable:
|
||||
# actually synchronous too, we'd blow the stack unless we stall for a
|
||||
# tick. Once you accept a Deferred from IUploadable.read(), you must
|
||||
# be prepared to have it fire immediately too.
|
||||
d.addCallback(eventual.fireEventually)
|
||||
d.addCallback(fireEventually)
|
||||
def _good(plaintext):
|
||||
# and encrypt it..
|
||||
# o/' over the fields we go, hashing all the way, sHA! sHA! sHA! o/'
|
||||
|
@ -1,8 +1,7 @@
|
||||
|
||||
from zope.interface import Interface
|
||||
from foolscap.schema import StringConstraint, ListOf, TupleOf, SetOf, DictOf, \
|
||||
ChoiceOf, IntegerConstraint, Any
|
||||
from foolscap import RemoteInterface, Referenceable
|
||||
from foolscap.api import StringConstraint, ListOf, TupleOf, SetOf, DictOf, \
|
||||
ChoiceOf, IntegerConstraint, Any, RemoteInterface, Referenceable
|
||||
|
||||
HASH_SIZE=32
|
||||
|
||||
|
@ -3,7 +3,7 @@ import re, time, sha
|
||||
from base64 import b32decode
|
||||
from zope.interface import implements
|
||||
from twisted.application import service
|
||||
from foolscap import Referenceable
|
||||
from foolscap.api import Referenceable
|
||||
from allmydata.interfaces import InsufficientVersionError
|
||||
from allmydata.introducer.interfaces import RIIntroducerSubscriberClient, \
|
||||
IIntroducerClient
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
from zope.interface import Interface
|
||||
from foolscap.schema import StringConstraint, TupleOf, SetOf, DictOf, Any
|
||||
from foolscap import RemoteInterface
|
||||
from foolscap.api import StringConstraint, TupleOf, SetOf, DictOf, Any, \
|
||||
RemoteInterface
|
||||
FURL = StringConstraint(1000)
|
||||
|
||||
# Announcements are (FURL, service_name, remoteinterface_name,
|
||||
|
@ -7,7 +7,7 @@ import re, time, sha
|
||||
from base64 import b32decode
|
||||
from zope.interface import implements
|
||||
from twisted.application import service
|
||||
from foolscap import Referenceable
|
||||
from foolscap.api import Referenceable
|
||||
from allmydata.util import log, idlib
|
||||
from allmydata.introducer.interfaces import RIIntroducerSubscriberClient, \
|
||||
IIntroducerClient, RIIntroducerPublisherAndSubscriberService
|
||||
|
@ -2,7 +2,7 @@
|
||||
import time, os.path
|
||||
from zope.interface import implements
|
||||
from twisted.application import service
|
||||
from foolscap import Referenceable
|
||||
from foolscap.api import Referenceable
|
||||
import allmydata
|
||||
from allmydata import node
|
||||
from allmydata.util import log
|
||||
|
@ -2,7 +2,7 @@
|
||||
import os
|
||||
import time
|
||||
|
||||
import foolscap
|
||||
from foolscap.api import Referenceable, Tub
|
||||
from zope.interface import implements
|
||||
from twisted.internet import reactor
|
||||
from twisted.application import service
|
||||
@ -11,7 +11,7 @@ from allmydata.util import log
|
||||
from pycryptopp.publickey import rsa
|
||||
from allmydata.interfaces import RIKeyGenerator
|
||||
|
||||
class KeyGenerator(service.MultiService, foolscap.Referenceable):
|
||||
class KeyGenerator(service.MultiService, Referenceable):
|
||||
implements(RIKeyGenerator)
|
||||
|
||||
pool_size = 16 # no. keys to keep on hand in the pool
|
||||
@ -79,7 +79,7 @@ class KeyGeneratorService(service.MultiService):
|
||||
def __init__(self, basedir='.', display_furl=True, default_key_size=2048):
|
||||
service.MultiService.__init__(self)
|
||||
self.basedir = basedir
|
||||
self.tub = foolscap.Tub(certFile=os.path.join(self.basedir, 'key_generator.pem'))
|
||||
self.tub = Tub(certFile=os.path.join(self.basedir, 'key_generator.pem'))
|
||||
self.tub.setServiceParent(self)
|
||||
self.key_generator = KeyGenerator(default_key_size=default_key_size)
|
||||
self.key_generator.setServiceParent(self)
|
||||
|
@ -3,7 +3,7 @@ import random
|
||||
|
||||
from zope.interface import implements
|
||||
from twisted.internet import defer, reactor
|
||||
from foolscap.eventual import eventually
|
||||
from foolscap.api import eventually
|
||||
from allmydata.interfaces import IMutableFileNode, IMutableFileURI, \
|
||||
ICheckable, ICheckResults, NotEnoughSharesError
|
||||
from allmydata.util import hashutil, log
|
||||
|
@ -10,7 +10,7 @@ from allmydata.util import base32, hashutil, mathutil, idlib, log
|
||||
from allmydata import hashtree, codec
|
||||
from allmydata.storage.server import si_b2a
|
||||
from pycryptopp.cipher.aes import AES
|
||||
from foolscap.eventual import eventually
|
||||
from foolscap.api import eventually
|
||||
|
||||
from common import MODE_WRITE, MODE_CHECK, DictOfSets, \
|
||||
UncoordinatedWriteError, NotEnoughServersError
|
||||
|
@ -4,8 +4,7 @@ from itertools import count
|
||||
from zope.interface import implements
|
||||
from twisted.internet import defer
|
||||
from twisted.python import failure
|
||||
from foolscap import DeadReferenceError
|
||||
from foolscap.eventual import eventually, fireEventually
|
||||
from foolscap.api import DeadReferenceError, eventually, fireEventually
|
||||
from allmydata.interfaces import IRetrieveStatus, NotEnoughSharesError
|
||||
from allmydata.util import hashutil, idlib, log
|
||||
from allmydata import hashtree, codec
|
||||
|
@ -4,8 +4,7 @@ from zope.interface import implements
|
||||
from itertools import count
|
||||
from twisted.internet import defer
|
||||
from twisted.python import failure
|
||||
from foolscap import DeadReferenceError
|
||||
from foolscap.eventual import eventually
|
||||
from foolscap.api import DeadReferenceError, eventually
|
||||
from allmydata.util import base32, hashutil, idlib, log, rrefutil
|
||||
from allmydata.storage.server import si_b2a
|
||||
from allmydata.interfaces import IServermapUpdaterStatus
|
||||
|
@ -5,15 +5,13 @@ from base64 import b32decode, b32encode
|
||||
from twisted.python import log as twlog
|
||||
from twisted.application import service
|
||||
from twisted.internet import defer, reactor
|
||||
from foolscap import Tub, eventual
|
||||
from foolscap.api import Tub, eventually, app_versions
|
||||
import foolscap.logging.log
|
||||
from allmydata import get_package_versions, get_package_versions_string
|
||||
from allmydata.util import log
|
||||
from allmydata.util import fileutil, iputil, observer
|
||||
from allmydata.util.assertutil import precondition, _assert
|
||||
|
||||
from foolscap.logging import app_versions
|
||||
|
||||
# Add our application versions to the data that Foolscap's LogPublisher
|
||||
# reports.
|
||||
for thing, things_version in get_package_versions().iteritems():
|
||||
@ -243,7 +241,7 @@ class Node(service.MultiService):
|
||||
except EnvironmentError:
|
||||
pass
|
||||
# Delay until the reactor is running.
|
||||
eventual.eventually(self._startService)
|
||||
eventually(self._startService)
|
||||
|
||||
def _startService(self):
|
||||
precondition(reactor.running)
|
||||
|
@ -9,10 +9,8 @@ from twisted.internet import reactor
|
||||
from twisted.application import service
|
||||
from twisted.application.internet import TimerService
|
||||
from zope.interface import implements
|
||||
import foolscap
|
||||
from foolscap.eventual import eventually
|
||||
from foolscap.api import eventually, DeadReferenceError, Referenceable, Tub
|
||||
from twisted.internet.error import ConnectionDone, ConnectionLost
|
||||
from foolscap import DeadReferenceError
|
||||
|
||||
from allmydata.util import log
|
||||
from allmydata.interfaces import RIStatsProvider, RIStatsGatherer, IStatsProducer
|
||||
@ -124,7 +122,7 @@ class CPUUsageMonitor(service.MultiService):
|
||||
return s
|
||||
|
||||
|
||||
class StatsProvider(foolscap.Referenceable, service.MultiService):
|
||||
class StatsProvider(Referenceable, service.MultiService):
|
||||
implements(RIStatsProvider)
|
||||
|
||||
def __init__(self, node, gatherer_furl):
|
||||
@ -180,7 +178,7 @@ class StatsProvider(foolscap.Referenceable, service.MultiService):
|
||||
gatherer.callRemoteOnly('provide', self, nickname or '')
|
||||
|
||||
|
||||
class StatsGatherer(foolscap.Referenceable, service.MultiService):
|
||||
class StatsGatherer(Referenceable, service.MultiService):
|
||||
implements(RIStatsGatherer)
|
||||
|
||||
poll_interval = 60
|
||||
@ -196,7 +194,7 @@ class StatsGatherer(foolscap.Referenceable, service.MultiService):
|
||||
self.timer.setServiceParent(self)
|
||||
|
||||
def get_tubid(self, rref):
|
||||
return foolscap.SturdyRef(rref.tracker.getURL()).getTubRef().getTubID()
|
||||
return rref.getRemoteTubID()
|
||||
|
||||
def remote_provide(self, provider, nickname):
|
||||
tubid = self.get_tubid(provider)
|
||||
@ -282,8 +280,8 @@ class StatsGathererService(service.MultiService):
|
||||
def __init__(self, basedir=".", verbose=False):
|
||||
service.MultiService.__init__(self)
|
||||
self.basedir = basedir
|
||||
self.tub = foolscap.Tub(certFile=os.path.join(self.basedir,
|
||||
"stats_gatherer.pem"))
|
||||
self.tub = Tub(certFile=os.path.join(self.basedir,
|
||||
"stats_gatherer.pem"))
|
||||
self.tub.setServiceParent(self)
|
||||
self.tub.setOption("logLocalFailures", True)
|
||||
self.tub.setOption("logRemoteFailures", True)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import os, stat, struct, time
|
||||
|
||||
from foolscap import Referenceable
|
||||
from foolscap.api import Referenceable
|
||||
|
||||
from zope.interface import implements
|
||||
from allmydata.interfaces import RIBucketWriter, RIBucketReader
|
||||
|
@ -1,6 +1,6 @@
|
||||
import os, re, weakref, struct, time
|
||||
|
||||
from foolscap import Referenceable
|
||||
from foolscap.api import Referenceable
|
||||
from twisted.application import service
|
||||
|
||||
from zope.interface import implements
|
||||
|
@ -9,8 +9,7 @@ from allmydata import client, introducer
|
||||
from allmydata.immutable import upload
|
||||
from allmydata.scripts import create_node
|
||||
from allmydata.util import fileutil, pollmixin
|
||||
import foolscap
|
||||
from foolscap import eventual
|
||||
from foolscap.api import Tub, fireEventually, flushEventualQueue
|
||||
from twisted.python import log
|
||||
|
||||
class StallableHTTPGetterDiscarder(tw_client.HTTPPageGetter):
|
||||
@ -74,7 +73,7 @@ class SystemFramework(pollmixin.PollMixin):
|
||||
self.sparent = service.MultiService()
|
||||
self.sparent.startService()
|
||||
self.proc = None
|
||||
self.tub = foolscap.Tub()
|
||||
self.tub = Tub()
|
||||
self.tub.setServiceParent(self.sparent)
|
||||
self.mode = mode
|
||||
self.failed = False
|
||||
@ -87,7 +86,7 @@ class SystemFramework(pollmixin.PollMixin):
|
||||
#logfile = open(os.path.join(self.testdir, "log"), "w")
|
||||
#flo = log.FileLogObserver(logfile)
|
||||
#log.startLoggingWithObserver(flo.emit, setStdout=False)
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
d.addCallback(lambda res: self.setUp())
|
||||
d.addCallback(lambda res: self.record_initial_memusage())
|
||||
d.addCallback(lambda res: self.make_nodes())
|
||||
@ -154,7 +153,7 @@ class SystemFramework(pollmixin.PollMixin):
|
||||
if self.proc:
|
||||
d.addCallback(lambda res: self.kill_client())
|
||||
d.addCallback(lambda res: self.sparent.stopService())
|
||||
d.addCallback(lambda res: eventual.flushEventualQueue())
|
||||
d.addCallback(lambda res: flushEventualQueue())
|
||||
def _close_statsfile(res):
|
||||
self.statsfile.close()
|
||||
d.addCallback(_close_statsfile)
|
||||
|
@ -4,7 +4,7 @@ import os, sys
|
||||
from twisted.internet import reactor, defer
|
||||
from twisted.python import log
|
||||
from twisted.application import service
|
||||
from foolscap import Tub, eventual
|
||||
from foolscap.api import Tub, fireEventually
|
||||
|
||||
MB = 1000000
|
||||
|
||||
@ -26,7 +26,7 @@ class SpeedTest:
|
||||
|
||||
def run(self):
|
||||
print "STARTING"
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
d.addCallback(lambda res: self.setUp())
|
||||
d.addCallback(lambda res: self.do_test())
|
||||
d.addBoth(self.tearDown)
|
||||
|
@ -5,7 +5,7 @@ from twisted.internet.interfaces import IConsumer
|
||||
from twisted.python import failure
|
||||
from twisted.application import service
|
||||
from twisted.web.error import Error as WebError
|
||||
from foolscap.eventual import flushEventualQueue, fireEventually
|
||||
from foolscap.api import flushEventualQueue, fireEventually
|
||||
from allmydata import uri, dirnode, client
|
||||
from allmydata.introducer.server import IntroducerNode
|
||||
from allmydata.interfaces import IURI, IMutableFileNode, IFileNode, \
|
||||
|
@ -17,8 +17,7 @@ import os.path
|
||||
import sha
|
||||
from twisted.application import service
|
||||
from twisted.internet import reactor
|
||||
from foolscap import Referenceable
|
||||
from foolscap.eventual import fireEventually
|
||||
from foolscap.api import Referenceable, fireEventually
|
||||
from base64 import b32encode
|
||||
from allmydata import uri as tahoe_uri
|
||||
from allmydata.client import Client
|
||||
|
@ -8,7 +8,7 @@ import allmydata
|
||||
from allmydata import client
|
||||
from allmydata.introducer.client import IntroducerClient
|
||||
from allmydata.util import base32
|
||||
from foolscap.eventual import flushEventualQueue
|
||||
from foolscap.api import flushEventualQueue
|
||||
import common_util as testutil
|
||||
|
||||
class FakeIntroducerClient(IntroducerClient):
|
||||
|
@ -4,7 +4,7 @@ import os.path
|
||||
from twisted.trial import unittest
|
||||
from twisted.application import service
|
||||
from twisted.internet import defer
|
||||
from foolscap import eventual
|
||||
from foolscap.api import eventually, fireEventually
|
||||
|
||||
from allmydata.util import fileutil, hashutil, pollmixin
|
||||
from allmydata.storage.server import StorageServer, si_b2a
|
||||
@ -23,7 +23,7 @@ class BucketEnumeratingCrawler(ShareCrawler):
|
||||
def process_bucket(self, cycle, prefix, prefixdir, storage_index_b32):
|
||||
self.all_buckets.append(storage_index_b32)
|
||||
def finished_cycle(self, cycle):
|
||||
eventual.eventually(self.finished_d.callback, None)
|
||||
eventually(self.finished_d.callback, None)
|
||||
|
||||
class PacedCrawler(ShareCrawler):
|
||||
cpu_slice = 500 # make sure it can complete in a single slice
|
||||
@ -45,7 +45,7 @@ class PacedCrawler(ShareCrawler):
|
||||
if self.yield_cb:
|
||||
self.yield_cb()
|
||||
def finished_cycle(self, cycle):
|
||||
eventual.eventually(self.finished_d.callback, None)
|
||||
eventually(self.finished_d.callback, None)
|
||||
|
||||
class ConsumingCrawler(ShareCrawler):
|
||||
cpu_slice = 0.5
|
||||
@ -420,7 +420,7 @@ class Basic(unittest.TestCase, StallMixin, pollmixin.PollMixin):
|
||||
|
||||
d = c.finished_d
|
||||
def _finished_first_cycle(ignored):
|
||||
return eventual.fireEventually(c.counter)
|
||||
return fireEventually(c.counter)
|
||||
d.addCallback(_finished_first_cycle)
|
||||
def _check(old_counter):
|
||||
# the crawler should do any work after it's been stopped
|
||||
|
@ -3,7 +3,7 @@ from twisted.trial import unittest
|
||||
from twisted.internet import defer, reactor
|
||||
from twisted.internet.interfaces import IConsumer
|
||||
from twisted.python.failure import Failure
|
||||
from foolscap import eventual
|
||||
from foolscap.api import fireEventually
|
||||
from allmydata import hashtree, uri
|
||||
from allmydata.immutable import encode, upload, download
|
||||
from allmydata.util import hashutil
|
||||
@ -40,7 +40,7 @@ class FakeBucketReaderWriterProxy:
|
||||
def _start(self):
|
||||
if self.mode == "lost-early":
|
||||
f = Failure(LostPeerError("I went away early"))
|
||||
return eventual.fireEventually(f)
|
||||
return fireEventually(f)
|
||||
return defer.succeed(self)
|
||||
|
||||
def put_header(self):
|
||||
@ -49,7 +49,7 @@ class FakeBucketReaderWriterProxy:
|
||||
def put_block(self, segmentnum, data):
|
||||
if self.mode == "lost-early":
|
||||
f = Failure(LostPeerError("I went away early"))
|
||||
return eventual.fireEventually(f)
|
||||
return fireEventually(f)
|
||||
def _try():
|
||||
assert not self.closed
|
||||
assert segmentnum not in self.blocks
|
||||
|
@ -2,7 +2,7 @@ import os
|
||||
from twisted.trial import unittest
|
||||
from twisted.application import service
|
||||
|
||||
from foolscap import Tub, eventual
|
||||
from foolscap.api import Tub, fireEventually, flushEventualQueue
|
||||
from foolscap.logging import log
|
||||
|
||||
from allmydata.storage.server import si_b2a
|
||||
@ -70,19 +70,19 @@ class FakeClient(service.MultiService):
|
||||
return []
|
||||
|
||||
def flush_but_dont_ignore(res):
|
||||
d = eventual.flushEventualQueue()
|
||||
d = flushEventualQueue()
|
||||
def _done(ignored):
|
||||
return res
|
||||
d.addCallback(_done)
|
||||
return d
|
||||
|
||||
def wait_a_few_turns(ignored=None):
|
||||
d = eventual.fireEventually()
|
||||
d.addCallback(eventual.fireEventually)
|
||||
d.addCallback(eventual.fireEventually)
|
||||
d.addCallback(eventual.fireEventually)
|
||||
d.addCallback(eventual.fireEventually)
|
||||
d.addCallback(eventual.fireEventually)
|
||||
d = fireEventually()
|
||||
d.addCallback(fireEventually)
|
||||
d.addCallback(fireEventually)
|
||||
d.addCallback(fireEventually)
|
||||
d.addCallback(fireEventually)
|
||||
d.addCallback(fireEventually)
|
||||
return d
|
||||
|
||||
def upload_data(uploader, data, convergence):
|
||||
@ -110,7 +110,7 @@ class AssistedUpload(unittest.TestCase):
|
||||
|
||||
def tearDown(self):
|
||||
d = self.s.stopService()
|
||||
d.addCallback(eventual.fireEventually)
|
||||
d.addCallback(fireEventually)
|
||||
d.addBoth(flush_but_dont_ignore)
|
||||
return d
|
||||
|
||||
|
@ -6,8 +6,7 @@ from twisted.trial import unittest
|
||||
from twisted.internet import defer
|
||||
from twisted.python import log
|
||||
|
||||
from foolscap import Tub, Referenceable
|
||||
from foolscap.eventual import fireEventually, flushEventualQueue
|
||||
from foolscap.api import Tub, Referenceable, fireEventually, flushEventualQueue
|
||||
from twisted.application import service
|
||||
from allmydata.interfaces import InsufficientVersionError
|
||||
from allmydata.introducer.client import IntroducerClient
|
||||
|
@ -3,14 +3,14 @@ import os
|
||||
from twisted.trial import unittest
|
||||
from twisted.application import service
|
||||
|
||||
from foolscap import Tub, eventual
|
||||
from foolscap.api import Tub, fireEventually, flushEventualQueue
|
||||
|
||||
from allmydata import key_generator
|
||||
from allmydata.util import pollmixin
|
||||
from pycryptopp.publickey import rsa
|
||||
|
||||
def flush_but_dont_ignore(res):
|
||||
d = eventual.flushEventualQueue()
|
||||
d = flushEventualQueue()
|
||||
def _done(ignored):
|
||||
return res
|
||||
d.addCallback(_done)
|
||||
@ -25,11 +25,11 @@ class KeyGenService(unittest.TestCase, pollmixin.PollMixin):
|
||||
t.setServiceParent(self.parent)
|
||||
t.listenOn("tcp:0")
|
||||
t.setLocationAutomatically()
|
||||
return eventual.fireEventually()
|
||||
return fireEventually()
|
||||
|
||||
def tearDown(self):
|
||||
d = self.parent.stopService()
|
||||
d.addCallback(eventual.fireEventually)
|
||||
d.addCallback(fireEventually)
|
||||
d.addBoth(flush_but_dont_ignore)
|
||||
return d
|
||||
|
||||
@ -50,7 +50,7 @@ class KeyGenService(unittest.TestCase, pollmixin.PollMixin):
|
||||
return len(kgs.key_generator.keypool) == kgs.key_generator.pool_size
|
||||
|
||||
# first wait for key gen pool to fill up
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
d.addCallback(p, 'waiting for pool to fill up')
|
||||
d.addCallback(lambda junk: self.poll(keypool_full))
|
||||
|
||||
|
@ -15,7 +15,7 @@ from allmydata.interfaces import IURI, IMutableFileURI, IUploadable, \
|
||||
FileTooLargeError, NotEnoughSharesError, IRepairResults
|
||||
from allmydata.monitor import Monitor
|
||||
from allmydata.test.common import ShouldFailMixin
|
||||
from foolscap.eventual import eventually, fireEventually
|
||||
from foolscap.api import eventually, fireEventually
|
||||
from foolscap.logging import log
|
||||
import sha
|
||||
|
||||
|
@ -4,7 +4,7 @@ from twisted.trial import unittest
|
||||
from twisted.internet import defer
|
||||
from twisted.python import log
|
||||
|
||||
from foolscap.eventual import flushEventualQueue
|
||||
from foolscap.api import flushEventualQueue
|
||||
from twisted.application import service
|
||||
from allmydata.node import Node, formatTimeTahoeStyle
|
||||
from allmydata.util import fileutil
|
||||
|
@ -5,7 +5,7 @@ from twisted.trial import unittest
|
||||
|
||||
from twisted.internet import defer
|
||||
from twisted.application import service
|
||||
from foolscap import eventual
|
||||
from foolscap.api import fireEventually
|
||||
import itertools
|
||||
from allmydata import interfaces
|
||||
from allmydata.util import fileutil, hashutil, base32, pollmixin, time_format
|
||||
@ -1391,7 +1391,7 @@ class BucketCounter(unittest.TestCase, pollmixin.PollMixin):
|
||||
# cpu_slice=0 will force it to yield right after it processes the
|
||||
# first prefix
|
||||
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
def _check(ignored):
|
||||
# are we really right after the first prefix?
|
||||
state = ss.bucket_counter.get_state()
|
||||
@ -1428,7 +1428,7 @@ class BucketCounter(unittest.TestCase, pollmixin.PollMixin):
|
||||
ss.bucket_counter.cpu_slice = 0
|
||||
ss.setServiceParent(self.s)
|
||||
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
|
||||
def _after_first_prefix(ignored):
|
||||
ss.bucket_counter.cpu_slice = 100.0 # finish as fast as possible
|
||||
@ -1613,7 +1613,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin):
|
||||
|
||||
DAY = 24*60*60
|
||||
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
|
||||
# now examine the state right after the first bucket has been
|
||||
# processed.
|
||||
@ -1813,7 +1813,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin):
|
||||
|
||||
ss.setServiceParent(self.s)
|
||||
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
# examine the state right after the first bucket has been processed
|
||||
def _after_first_bucket(ignored):
|
||||
p = lc.get_progress()
|
||||
@ -1954,7 +1954,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin):
|
||||
|
||||
ss.setServiceParent(self.s)
|
||||
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
# examine the state right after the first bucket has been processed
|
||||
def _after_first_bucket(ignored):
|
||||
p = lc.get_progress()
|
||||
@ -2220,7 +2220,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin):
|
||||
|
||||
ss.setServiceParent(self.s)
|
||||
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
def _check(ignored):
|
||||
# this should fire after the first bucket is complete, but before
|
||||
# the first prefix is complete, so the progress-measurer won't
|
||||
@ -2338,7 +2338,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin):
|
||||
|
||||
ss.setServiceParent(self.s)
|
||||
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
|
||||
# now examine the state right after the first bucket has been
|
||||
# processed.
|
||||
|
@ -20,7 +20,7 @@ from allmydata.interfaces import IDirectoryNode, IFileNode, IFileURI, \
|
||||
from allmydata.monitor import Monitor
|
||||
from allmydata.mutable.common import NotMutableError
|
||||
from allmydata.mutable import layout as mutable_layout
|
||||
from foolscap import DeadReferenceError
|
||||
from foolscap.api import DeadReferenceError
|
||||
from twisted.python.failure import Failure
|
||||
from twisted.web.client import getPage
|
||||
from twisted.web.error import Error
|
||||
|
@ -5,7 +5,7 @@ from twisted.trial import unittest
|
||||
from twisted.python.failure import Failure
|
||||
from twisted.python import log
|
||||
from twisted.internet import defer
|
||||
from foolscap import eventual
|
||||
from foolscap.api import fireEventually
|
||||
|
||||
import allmydata # for __full_version__
|
||||
from allmydata import uri, monitor
|
||||
@ -97,7 +97,7 @@ class FakeStorageServer:
|
||||
def _call():
|
||||
meth = getattr(self, methname)
|
||||
return meth(*args, **kwargs)
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
d.addCallback(lambda res: _call())
|
||||
return d
|
||||
|
||||
@ -128,7 +128,7 @@ class FakeBucketWriter:
|
||||
def _call():
|
||||
meth = getattr(self, "remote_" + methname)
|
||||
return meth(*args, **kwargs)
|
||||
d = eventual.fireEventually()
|
||||
d = fireEventually()
|
||||
d.addCallback(lambda res: _call())
|
||||
return d
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
from twisted.internet import defer
|
||||
from foolscap.eventual import eventually
|
||||
from foolscap.api import eventually
|
||||
|
||||
class ConcurrencyLimiter:
|
||||
"""I implement a basic concurrency limiter. Add work to it in the form of
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- test-case-name: allmydata.test.test_observer -*-
|
||||
|
||||
from twisted.internet import defer
|
||||
from foolscap.eventual import eventually
|
||||
from foolscap.api import eventually
|
||||
|
||||
"""The idiom we use is for the observed object to offer a method named
|
||||
'when_something', which returns a deferred. That deferred will be fired when
|
||||
|
@ -1,6 +1,6 @@
|
||||
import exceptions
|
||||
|
||||
from foolscap.tokens import Violation
|
||||
from foolscap.api import Violation
|
||||
|
||||
class ServerFailure(exceptions.Exception):
|
||||
# If the server returns a Failure instead of the normal response to a
|
||||
|
@ -10,7 +10,7 @@ from twisted.web import http, html
|
||||
from nevow import url, rend, inevow, tags as T
|
||||
from nevow.inevow import IRequest
|
||||
|
||||
from foolscap.eventual import fireEventually
|
||||
from foolscap.api import fireEventually
|
||||
|
||||
from allmydata.util import base32, time_format
|
||||
from allmydata.uri import from_string_dirnode
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
import time
|
||||
from nevow import rend, inevow
|
||||
from foolscap.referenceable import SturdyRef
|
||||
from foolscap.api import SturdyRef
|
||||
from twisted.internet import address
|
||||
import allmydata
|
||||
import simplejson
|
||||
|
Loading…
Reference in New Issue
Block a user