Extracting index building code to be run optionally

This is to allow the correct operation of local/remote lookups to be correctly indexed (after the resolver has run). Addresses an issue in vacuum https://github.com/daveshanley/vacuum/issues/294

Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
Dave Shanley
2023-06-17 12:54:51 -04:00
committed by quobix
parent c6659c8a5b
commit a4b7a01c43
4 changed files with 32 additions and 10 deletions

View File

@@ -76,6 +76,13 @@ type SpecIndexConfig struct {
// a breakglass to be used to prevent loops, checking the tree before recursing down.
ParentIndex *SpecIndex
// If set to true, the index will not be built out, which means only the foundational elements will be
// parsed and added to the index. This is useful to avoid building out an index if the specification is
// broken up into references and you want it fully resolved.
//
// Use the `BuildIndex()` method on the index to build it out once resolved/ready.
AvoidBuildIndex bool
// private fields
seenRemoteSources *syncmap.Map
remoteLock *sync.Mutex