Merge pull request #654 from tahoe-lafs/3250.synchronous-get_storage_client

Synchronous IFoolscapStoragePlugin.get_storage_client

Fixes: ticket:3250
This commit is contained in:
Jean-Paul Calderone 2019-08-23 08:44:52 -04:00 committed by GitHub
commit 25c476aaa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 3 deletions

0
newsfragments/3250.minor Normal file
View File

View File

@ -3114,7 +3114,7 @@ class IFoolscapStoragePlugin(IPlugin):
server portion of this plugin on the currently active connection, server portion of this plugin on the currently active connection,
or ``None`` if no connection has been established yet. or ``None`` if no connection has been established yet.
:rtype: ``Deferred`` firing with ``IStorageServer`` :rtype: ``IStorageServer``
""" """
def get_client_resource(configuration): def get_client_resource(configuration):

View File

@ -452,7 +452,7 @@ class _FoolscapStorage(object):
permutation_seed = attr.ib() permutation_seed = attr.ib()
tubid = attr.ib() tubid = attr.ib()
storage_server = attr.ib() storage_server = attr.ib(validator=attr.validators.provides(IStorageServer))
_furl = attr.ib() _furl = attr.ib()
_short_description = attr.ib() _short_description = attr.ib()

View File

@ -15,6 +15,9 @@ from testtools.matchers import (
AfterPreprocessing, AfterPreprocessing,
) )
from zope.interface import (
implementer,
)
from zope.interface.verify import ( from zope.interface.verify import (
verifyObject, verifyObject,
) )
@ -59,6 +62,7 @@ from allmydata.storage_client import (
) )
from allmydata.interfaces import ( from allmydata.interfaces import (
IConnectionStatus, IConnectionStatus,
IStorageServer,
) )
SOME_FURL = b"pb://abcde@nowhere/fake" SOME_FURL = b"pb://abcde@nowhere/fake"
@ -381,6 +385,9 @@ class FoolscapStorageServers(unittest.TestCase):
""" """
Instances of ``_FoolscapStorage`` provide ``IFoolscapStorageServer``. Instances of ``_FoolscapStorage`` provide ``IFoolscapStorageServer``.
""" """
@implementer(IStorageServer)
class NotStorageServer(object):
pass
self.assertTrue( self.assertTrue(
verifyObject( verifyObject(
IFoolscapStorageServer, IFoolscapStorageServer,
@ -388,7 +395,7 @@ class FoolscapStorageServers(unittest.TestCase):
u"server-id", u"server-id",
SOME_FURL, SOME_FURL,
{u"permutation-seed-base32": base32.b2a(b"permutationseed")}, {u"permutation-seed-base32": base32.b2a(b"permutationseed")},
object(), NotStorageServer(),
), ),
), ),
) )