mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 08:52:39 +01: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:
parent
2d8156a727
commit
e3030ebcad
1 changed files with 12 additions and 2 deletions
|
@ -40,7 +40,7 @@ final class ArcanistConduitEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newCall($method, array $parameters) {
|
public function newCall($method, array $parameters) {
|
||||||
if ($this->conduitURI == null) {
|
if ($this->conduitURI == null && $this->client === null) {
|
||||||
$this->raiseURIException();
|
$this->raiseURIException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,9 +78,11 @@ final class ArcanistConduitEngine
|
||||||
if ($token) {
|
if ($token) {
|
||||||
$client->setConduitToken($this->getConduitToken());
|
$client->setConduitToken($this->getConduitToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->client = $client;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $client;
|
return $this->client;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function raiseURIException() {
|
private function raiseURIException() {
|
||||||
|
@ -105,4 +107,12 @@ final class ArcanistConduitEngine
|
||||||
throw new ArcanistUsageException($block->drawConsoleString());
|
throw new ArcanistUsageException($block->drawConsoleString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function newConduitEngineFromConduitClient(
|
||||||
|
ConduitClient $client) {
|
||||||
|
|
||||||
|
$engine = new self();
|
||||||
|
$engine->client = $client;
|
||||||
|
|
||||||
|
return $engine;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue