execgraph: Most of the "compiler" machinery

This covers most of the logic required to turn a source graph into a
compiled graph ready for execution. There's currently only support for one
of the opcodes though, so subsequent commits will sketch those out more
and then add some tests and fix any problems that inevitably exist here but
aren't yet visible because there are no tests.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit is contained in:
Martin Atkins
2025-09-29 12:10:38 -07:00
parent dbc78fce47
commit 4218231438
8 changed files with 702 additions and 18 deletions

View File

@@ -88,3 +88,31 @@ func (c *ConfigInstance) DriveApplying(ctx context.Context, glue ApplyGlue, run
// the oracle only once it has already been made available by earlier work.
type ApplyOracle struct {
}
// DesiredResourceInstance returns the [DesiredResourceInstance] object
// associated with the given resource instance address, or nil if the given
// address does not match a desired resource instance.
//
// This API assumes that the apply phase is working from an execution graph
// built during the planning phase and is therefore relying on the plan phase
// to correctly describe a subset of the desired resource instances so that
// this should never return nil. If this _does_ return nil then that suggests
// a bug in the planning engine, which caused it to create an incorrect
// execution graph.
func (o *ApplyOracle) DesiredResourceInstance(ctx context.Context, addr addrs.AbsResourceInstance) *DesiredResourceInstance {
// TODO: Implement
panic("unimplemented")
}
// ProviderInstanceConfig returns the configuration value for the given
// provider instance, or [cty.NilVal] if there is no such provider instance.
//
// This API assumes that the apply phase is working from an execution graph
// built during the planning phase and is therefore relyingo n the plan phase
// to refer only to provider instances that are present ni the configuration.
// If this _does_ return cty.NilVal then that suggests a bug in the planning
// engine, causing it to create an incorrect execution graph.
func (o *ApplyOracle) ProviderInstanceConfig(ctx context.Context, addr addrs.AbsProviderInstanceCorrect) cty.Value {
// TODO: Implement
panic("unimplemented")
}