1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-20 00:49:11 +02:00

Allow construction of a ConduitEngine with a bare ConduitClient

Summary:
See PHI1735. "ConduitEngine" was once a future pool, but this has moved to "HardpointEngine". This class may no longer make much sense.

In Phacility code, "bin/host upload" depends on using the Uploader, which needs a "ConduitEngine", not a "ConduitClient". This workflow may use asymmetric key signing, which "ConduitEngine" does not support.

To unblock PHI1735, provide glue code between "Client" and "Engine". But a "more correct" change is probably removal of "Engine".

Test Plan:
  - Ran `bin/host upload`, uploaded files (with additional changes to wrap the Client).
  - Created this revision.

Differential Revision: https://secure.phabricator.com/D21260
This commit is contained in:
epriestley 2020-05-15 08:20:00 -07:00
parent 2d8156a727
commit e3030ebcad

View file

@ -40,7 +40,7 @@ final class ArcanistConduitEngine
}
public function newCall($method, array $parameters) {
if ($this->conduitURI == null) {
if ($this->conduitURI == null && $this->client === null) {
$this->raiseURIException();
}
@ -78,9 +78,11 @@ final class ArcanistConduitEngine
if ($token) {
$client->setConduitToken($this->getConduitToken());
}
$this->client = $client;
}
return $client;
return $this->client;
}
private function raiseURIException() {
@ -105,4 +107,12 @@ final class ArcanistConduitEngine
throw new ArcanistUsageException($block->drawConsoleString());
}
public static function newConduitEngineFromConduitClient(
ConduitClient $client) {
$engine = new self();
$engine->client = $client;
return $engine;
}
}