Key
- The types of Keys used to query for the result on the graph computationResult
- The result of the computation given a specific key.public interface GraphComputation<Key extends ComputeKey<Result>,Result extends ComputeResult>
GraphTransformationEngine
.
The transformation is guaranteed the following conditions:
transform(ComputeKey, ComputationEnvironment)
is only called once per key if
caching is enabled.
transform(ComputeKey, ComputationEnvironment)
is only called after all keys in
discoverDeps(ComputeKey, ComputationEnvironment)
has been computed.
discoverDeps(ComputeKey, ComputationEnvironment)
is only called after all keys
in discoverPreliminaryDeps(ComputeKey)
has been computed
GraphComputation
s.Modifier and Type | Method and Description |
---|---|
com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> |
discoverDeps(Key key,
ComputationEnvironment env)
Compute dependent keys required to compute given key, and a set of dependencies as listed by
discoverPreliminaryDeps(ComputeKey) . |
com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> |
discoverPreliminaryDeps(Key key)
Compute dependent keys required to compute given the current key.
|
ComputationIdentifier<Result> |
getIdentifier() |
Result |
transform(Key key,
ComputationEnvironment env)
Perform a transformation identified by key
Key into a final type Result . |
ComputationIdentifier<Result> getIdentifier()
ComputeKey.getIdentifier()
Result transform(Key key, ComputationEnvironment env) throws Exception
Key
into a final type Result
. This
transformation should be performed synchronously.key
- The Key of the requested resultenv
- The execution environment containing results of keys from discoverDeps(ComputeKey, ComputationEnvironment)
and discoverPreliminaryDeps(ComputeKey)
Exception
com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> discoverDeps(Key key, ComputationEnvironment env) throws Exception
discoverPreliminaryDeps(ComputeKey)
. The results of those computations will be
available in transform(ComputeKey, ComputationEnvironment)
as a part of ComputationEnvironment
key
- the current key to transformenv
- The execution environment containing results of keys from discoverPreliminaryDeps(ComputeKey)
Exception
com.google.common.collect.ImmutableSet<? extends ComputeKey<? extends ComputeResult>> discoverPreliminaryDeps(Key key) throws Exception
discoverDeps(ComputeKey, ComputationEnvironment)
as
a part of ComputationEnvironment
, and transform(ComputeKey,
ComputationEnvironment)
key
- the current key to transformdiscoverDeps(ComputeKey, ComputationEnvironment)
and
transform(ComputeKey, ComputationEnvironment)
of the current key depends onException