Changeset View
Changeset View
Standalone View
Standalone View
src/toolset/query/ArcanistWorkflowHardpointQuery.php
| Show All 32 Lines | final public function canLoadObject(ArcanistHardpointObject $object) { | ||||
| if ($this->canLoadHardpoint === null) { | if ($this->canLoadHardpoint === null) { | ||||
| $this->canLoadHardpoint = $this->canLoadHardpoint(); | $this->canLoadHardpoint = $this->canLoadHardpoint(); | ||||
| } | } | ||||
| if (!$this->canLoadHardpoint) { | if (!$this->canLoadHardpoint) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (!$object instanceof ArcanistRefPro) { | if (!$object instanceof ArcanistRef) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return $this->canLoadRef($object); | return $this->canLoadRef($object); | ||||
| } | } | ||||
| protected function canLoadHardpoint() { | protected function canLoadHardpoint() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| abstract protected function canLoadRef(ArcanistRefPro $ref); | abstract protected function canLoadRef(ArcanistRef $ref); | ||||
| final public function yieldConduit($method, array $parameters) { | final public function yieldConduit($method, array $parameters) { | ||||
| $conduit_engine = $this->getWorkflow() | $conduit_engine = $this->getWorkflow() | ||||
| ->getConduitEngine(); | ->getConduitEngine(); | ||||
| $call_object = $conduit_engine->newCall($method, $parameters); | $call_object = $conduit_engine->newCall($method, $parameters); | ||||
| $call_future = $conduit_engine->newFuture($call_object); | $call_future = $conduit_engine->newFuture($call_object); | ||||
| return $this->yieldFuture($call_future); | return $this->yieldFuture($call_future); | ||||
| } | } | ||||
| final public function yieldRepositoryRef() { | final public function yieldRepositoryRef() { | ||||
| $workflow = $this->getWorkflow(); | $workflow = $this->getWorkflow(); | ||||
| // TODO: This is currently a blocking request, but should yield to the | // TODO: This is currently a blocking request, but should yield to the | ||||
| // hardpoint engine in the future. | // hardpoint engine in the future. | ||||
| $repository_ref = $workflow->getRepositoryRef(); | $repository_ref = $workflow->getRepositoryRef(); | ||||
| $ref_future = new ImmediateFuture($repository_ref); | $ref_future = new ImmediateFuture($repository_ref); | ||||
| return $this->yieldFuture($ref_future); | return $this->yieldFuture($ref_future); | ||||
| } | } | ||||
| final public function yieldValue(array $refs, $value) { | final public function yieldValue(array $refs, $value) { | ||||
| assert_instances_of($refs, 'ArcanistRefPro'); | assert_instances_of($refs, 'ArcanistRef'); | ||||
| $keys = array_keys($refs); | $keys = array_keys($refs); | ||||
| $map = array_fill_keys($keys, $value); | $map = array_fill_keys($keys, $value); | ||||
| return $this->yieldMap($map); | return $this->yieldMap($map); | ||||
| } | } | ||||
| final public function yieldMap(array $map) { | final public function yieldMap(array $map) { | ||||
| return new ArcanistHardpointTaskResult($map); | return new ArcanistHardpointTaskResult($map); | ||||
| } | } | ||||
| } | } | ||||