Skip to content

Commit

Permalink
feat(planstate): add extension support
Browse files Browse the repository at this point in the history
  • Loading branch information
flotter committed Aug 20, 2024
1 parent 662fd6a commit 6351aa2
Show file tree
Hide file tree
Showing 3 changed files with 494 additions and 1 deletion.
7 changes: 7 additions & 0 deletions internals/overlord/planstate/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ func NewManager(layersDir string) (*PlanManager, error) {
return manager, nil
}

// RegisterExtension adds a plan extension which extends the plan schema. All
// extensions must be registered before Load() is called.
func (m *PlanManager) RegisterExtension(field string, ext plan.LayerSectionExtension) error {
return plan.RegisterExtension(field, ext)
}

// Load reads plan layers from the pebble directory, combines and validates the
// final plan, and finally notifies registered managers of the plan update. In
// the case of a non-existent layers directory, or no layers in the layers
Expand Down Expand Up @@ -181,6 +187,7 @@ func (m *PlanManager) updatePlanLayers(layers []*plan.Layer) (*plan.Plan, error)
Services: combined.Services,
Checks: combined.Checks,
LogTargets: combined.LogTargets,
Sections: combined.Sections,
}
err = p.Validate()
if err != nil {
Expand Down
Loading

0 comments on commit 6351aa2

Please sign in to comment.