BaseKey
- the key type contained in the composed key of the base computationResult2
- the result type contained in the composed result of this computationpublic interface ComposedComputation<BaseKey extends ComputeKey<?>,Result2 extends ComputeResult> extends GraphComputation<ComposedKey<BaseKey,Result2>,ComposedResult<ComputeKey<Result2>,Result2>>
GraphComputation
that represents the Composition
of a ComposedComputation
that we can the base computation, a Composer
, and a Transformer
.
This computation has a ComposedKey
of the primary computation key and the result of
the Transformer
. After the base computation completes, the Composer
will be
invoked for each individual result in the ComposedResult
of the base computation,
returning a set of dependencies necessary for the transform step. Then Transformer
is
invoked with the dependencies.
The computation is identified by the base computation it begins at and the target result type
class, which means that no two ComposedComputation
s that begins and ends at the same
computations can be registered with the graph engine, regardless of what intermediate paths they
may differ at.
Modifier and Type | Method and Description |
---|---|
GraphComputationStage<ComposedKey<BaseKey,Result2>,ComposedResult<ComputeKey<Result2>,Result2>> |
asStage() |
com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> |
discoverDeps(ComposedKey<BaseKey,Result2> key,
ComputationEnvironment env)
Compute dependent keys required to compute given key, and a set of dependencies as listed by
GraphComputation.discoverPreliminaryDeps(ComputeKey) . |
com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> |
discoverPreliminaryDeps(ComposedKey<BaseKey,Result2> key)
Compute dependent keys required to compute given the current key.
|
ComposedComputationIdentifier<Result2> |
getIdentifier() |
ComposedResult<ComputeKey<Result2>,Result2> |
transform(ComposedKey<BaseKey,Result2> key,
ComputationEnvironment env)
Perform a transformation identified by key
Key into a final type Result . |
ComposedComputationIdentifier<Result2> getIdentifier()
getIdentifier
in interface GraphComputation<ComposedKey<BaseKey extends ComputeKey<?>,Result2 extends ComputeResult>,ComposedResult<ComputeKey<Result2 extends ComputeResult>,Result2 extends ComputeResult>>
ComputeKey.getIdentifier()
ComposedResult<ComputeKey<Result2>,Result2> transform(ComposedKey<BaseKey,Result2> key, ComputationEnvironment env) throws Exception
GraphComputation
Key
into a final type Result
. This
transformation should be performed synchronously.transform
in interface GraphComputation<ComposedKey<BaseKey extends ComputeKey<?>,Result2 extends ComputeResult>,ComposedResult<ComputeKey<Result2 extends ComputeResult>,Result2 extends ComputeResult>>
key
- The Key of the requested resultenv
- The execution environment containing results of keys from GraphComputation.discoverDeps(ComputeKey, ComputationEnvironment)
and GraphComputation.discoverPreliminaryDeps(ComputeKey)
Exception
com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> discoverDeps(ComposedKey<BaseKey,Result2> key, ComputationEnvironment env) throws Exception
GraphComputation
GraphComputation.discoverPreliminaryDeps(ComputeKey)
. The results of those computations will be
available in GraphComputation.transform(ComputeKey, ComputationEnvironment)
as a part of ComputationEnvironment
discoverDeps
in interface GraphComputation<ComposedKey<BaseKey extends ComputeKey<?>,Result2 extends ComputeResult>,ComposedResult<ComputeKey<Result2 extends ComputeResult>,Result2 extends ComputeResult>>
key
- the current key to transformenv
- The execution environment containing results of keys from GraphComputation.discoverPreliminaryDeps(ComputeKey)
Exception
com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> discoverPreliminaryDeps(ComposedKey<BaseKey,Result2> key)
GraphComputation
GraphComputation.discoverDeps(ComputeKey, ComputationEnvironment)
as
a part of ComputationEnvironment
, and GraphComputation.transform(ComputeKey,
ComputationEnvironment)
discoverPreliminaryDeps
in interface GraphComputation<ComposedKey<BaseKey extends ComputeKey<?>,Result2 extends ComputeResult>,ComposedResult<ComputeKey<Result2 extends ComputeResult>,Result2 extends ComputeResult>>
key
- the current key to transformGraphComputation.discoverDeps(ComputeKey, ComputationEnvironment)
and
GraphComputation.transform(ComputeKey, ComputationEnvironment)
of the current key depends onGraphComputationStage<ComposedKey<BaseKey,Result2>,ComposedResult<ComputeKey<Result2>,Result2>> asStage()
GraphComputationStage
for registering this computation with the
GraphTransformationEngine