mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-19 07:48:11 +00:00
rename introducer_factory parameter to be private
This commit is contained in:
@ -247,7 +247,7 @@ def create_client(basedir=u".", _client_factory=None):
|
|||||||
return defer.fail()
|
return defer.fail()
|
||||||
|
|
||||||
|
|
||||||
def create_client_from_config(config, _client_factory=None, introducer_factory=None):
|
def create_client_from_config(config, _client_factory=None, _introducer_factory=None):
|
||||||
"""
|
"""
|
||||||
Creates a new client instance (a subclass of Node). Most code
|
Creates a new client instance (a subclass of Node). Most code
|
||||||
should probably use `create_client` instead.
|
should probably use `create_client` instead.
|
||||||
@ -260,7 +260,7 @@ def create_client_from_config(config, _client_factory=None, introducer_factory=N
|
|||||||
:param _client_factory: for testing; the class to instantiate
|
:param _client_factory: for testing; the class to instantiate
|
||||||
instead of _Client
|
instead of _Client
|
||||||
|
|
||||||
:param introducer_factory: for testing; the class to instantiate instead
|
:param _introducer_factory: for testing; the class to instantiate instead
|
||||||
of IntroducerClient
|
of IntroducerClient
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@ -279,7 +279,7 @@ def create_client_from_config(config, _client_factory=None, introducer_factory=N
|
|||||||
)
|
)
|
||||||
control_tub = node.create_control_tub()
|
control_tub = node.create_control_tub()
|
||||||
|
|
||||||
introducer_clients = create_introducer_clients(config, main_tub, introducer_factory)
|
introducer_clients = create_introducer_clients(config, main_tub, _introducer_factory)
|
||||||
storage_broker = create_storage_farm_broker(
|
storage_broker = create_storage_farm_broker(
|
||||||
config, default_connection_handlers, foolscap_connection_handlers,
|
config, default_connection_handlers, foolscap_connection_handlers,
|
||||||
tub_options, introducer_clients
|
tub_options, introducer_clients
|
||||||
@ -323,17 +323,17 @@ def _sequencer(config):
|
|||||||
return seqnum, nonce
|
return seqnum, nonce
|
||||||
|
|
||||||
|
|
||||||
def create_introducer_clients(config, main_tub, introducer_factory=None):
|
def create_introducer_clients(config, main_tub, _introducer_factory=None):
|
||||||
"""
|
"""
|
||||||
Read, validate and parse any 'introducers.yaml' configuration.
|
Read, validate and parse any 'introducers.yaml' configuration.
|
||||||
|
|
||||||
:param introducer_factory: for testing; the class to instantiate instead
|
:param _introducer_factory: for testing; the class to instantiate instead
|
||||||
of IntroducerClient
|
of IntroducerClient
|
||||||
|
|
||||||
:returns: a list of IntroducerClient instances
|
:returns: a list of IntroducerClient instances
|
||||||
"""
|
"""
|
||||||
if introducer_factory is None:
|
if _introducer_factory is None:
|
||||||
introducer_factory = IntroducerClient
|
_introducer_factory = IntroducerClient
|
||||||
|
|
||||||
# we return this list
|
# we return this list
|
||||||
introducer_clients = []
|
introducer_clients = []
|
||||||
@ -380,7 +380,7 @@ def create_introducer_clients(config, main_tub, introducer_factory=None):
|
|||||||
|
|
||||||
for petname, introducer in introducers.items():
|
for petname, introducer in introducers.items():
|
||||||
introducer_cache_filepath = FilePath(config.get_private_path("introducer_{}_cache.yaml".format(petname)))
|
introducer_cache_filepath = FilePath(config.get_private_path("introducer_{}_cache.yaml".format(petname)))
|
||||||
ic = introducer_factory(
|
ic = _introducer_factory(
|
||||||
main_tub,
|
main_tub,
|
||||||
introducer['furl'].encode("ascii"),
|
introducer['furl'].encode("ascii"),
|
||||||
config.nickname,
|
config.nickname,
|
||||||
|
@ -1139,7 +1139,10 @@ introducer.furl = pb://abcde@nowhere/fake
|
|||||||
self.get_config(storage_enabled=False),
|
self.get_config(storage_enabled=False),
|
||||||
)
|
)
|
||||||
self.assertThat(
|
self.assertThat(
|
||||||
client.create_client_from_config(config, introducer_factory=MemoryIntroducerClient),
|
client.create_client_from_config(
|
||||||
|
config,
|
||||||
|
_introducer_factory=MemoryIntroducerClient,
|
||||||
|
),
|
||||||
succeeded(AfterPreprocessing(
|
succeeded(AfterPreprocessing(
|
||||||
get_published_announcements,
|
get_published_announcements,
|
||||||
Equals([]),
|
Equals([]),
|
||||||
@ -1159,7 +1162,7 @@ introducer.furl = pb://abcde@nowhere/fake
|
|||||||
)
|
)
|
||||||
client_deferred = client.create_client_from_config(
|
client_deferred = client.create_client_from_config(
|
||||||
config,
|
config,
|
||||||
introducer_factory=MemoryIntroducerClient,
|
_introducer_factory=MemoryIntroducerClient,
|
||||||
)
|
)
|
||||||
self.assertThat(
|
self.assertThat(
|
||||||
client_deferred,
|
client_deferred,
|
||||||
@ -1197,7 +1200,10 @@ introducer.furl = pb://abcde@nowhere/fake
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.assertThat(
|
self.assertThat(
|
||||||
client.create_client_from_config(config, introducer_factory=MemoryIntroducerClient),
|
client.create_client_from_config(
|
||||||
|
config,
|
||||||
|
_introducer_factory=MemoryIntroducerClient,
|
||||||
|
),
|
||||||
succeeded(AfterPreprocessing(
|
succeeded(AfterPreprocessing(
|
||||||
get_published_announcements,
|
get_published_announcements,
|
||||||
MatchesListwise([
|
MatchesListwise([
|
||||||
@ -1234,7 +1240,10 @@ introducer.furl = pb://abcde@nowhere/fake
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.assertThat(
|
self.assertThat(
|
||||||
client.create_client_from_config(config, introducer_factory=MemoryIntroducerClient),
|
client.create_client_from_config(
|
||||||
|
config,
|
||||||
|
_introducer_factory=MemoryIntroducerClient,
|
||||||
|
),
|
||||||
succeeded(AfterPreprocessing(
|
succeeded(AfterPreprocessing(
|
||||||
get_published_announcements,
|
get_published_announcements,
|
||||||
MatchesListwise([
|
MatchesListwise([
|
||||||
@ -1276,11 +1285,11 @@ introducer.furl = pb://abcde@nowhere/fake
|
|||||||
)
|
)
|
||||||
node_a = client.create_client_from_config(
|
node_a = client.create_client_from_config(
|
||||||
config,
|
config,
|
||||||
introducer_factory=MemoryIntroducerClient,
|
_introducer_factory=MemoryIntroducerClient,
|
||||||
)
|
)
|
||||||
node_b = client.create_client_from_config(
|
node_b = client.create_client_from_config(
|
||||||
config,
|
config,
|
||||||
introducer_factory=MemoryIntroducerClient,
|
_introducer_factory=MemoryIntroducerClient,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertThat(
|
self.assertThat(
|
||||||
@ -1307,7 +1316,10 @@ introducer.furl = pb://abcde@nowhere/fake
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.assertThat(
|
self.assertThat(
|
||||||
client.create_client_from_config(config, introducer_factory=MemoryIntroducerClient),
|
client.create_client_from_config(
|
||||||
|
config,
|
||||||
|
_introducer_factory=MemoryIntroducerClient,
|
||||||
|
),
|
||||||
succeeded(AfterPreprocessing(
|
succeeded(AfterPreprocessing(
|
||||||
get_published_announcements,
|
get_published_announcements,
|
||||||
MatchesListwise([
|
MatchesListwise([
|
||||||
@ -1344,6 +1356,9 @@ introducer.furl = pb://abcde@nowhere/fake
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.assertThat(
|
self.assertThat(
|
||||||
client.create_client_from_config(config, introducer_factory=MemoryIntroducerClient),
|
client.create_client_from_config(
|
||||||
|
config,
|
||||||
|
_introducer_factory=MemoryIntroducerClient,
|
||||||
|
),
|
||||||
failed(Always()),
|
failed(Always()),
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user