Interface ModelActionBuilder


public interface ModelActionBuilder
Builder for effective model inference action. Model inference action is core principle of transforming declared model into effective model.

Since YANG allows forward references, some inference actions need to be taken at a later point, where reference is actually resolved. Referenced objects are not retrieved directly but are represented as ModelActionBuilder.Prerequisite (prerequisite) for inference action to be taken.

Some existing YANG statements are more complex and also object, for which effective model may be inferred is also represented as a ModelActionBuilder.Prerequisite which, when reference is available, will contain target context, which may be used for inference action.

Implementing inference action

Effective inference action could always be splitted into two separate tasks:
  1. Declaration of inference action and its prerequisites
  2. Execution of inference action

In order to declare inference action following steps needs to be taken:

  1. Use StmtContext.Mutable.newInferenceAction(ModelProcessingPhase) to obtain ModelActionBuilder.
  2. Use builder to specify concrete prerequisites of inference action (other statements, values from identifier namespaces)
  3. Use builder to specify concrete set of nodes (or forward references to nodes) which will inference action mutate.
  4. Use apply(InferenceAction) with ModelActionBuilder.InferenceAction implementation to register inference action.

An action will be executed when:

TODO: Insert real word example

Design notes

Future seems as viable and more standard alternative to ModelActionBuilder.Prerequisite, but Futures also carries promise that resolution of it is carried in other thread, which will actually put additional constraints on semantic parser.

Also listening on multiple futures is costly, so we opted out of future and designed API, which later may introduce futures.