Share a source index across each pipeline run
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/core/source"
|
||||
@@ -66,8 +65,8 @@ type RunInput struct {
|
||||
stepID string
|
||||
references map[referenceTargetKey]contracts.ReferenceSet
|
||||
referenceReuseEligibility map[referenceTargetKey]bool
|
||||
// Shared by operation decoders, but built only when a cache hit needs it.
|
||||
cacheSourceIndex func() source.DocumentIndex
|
||||
// Shared read-only by extraction jobs and cache decoders for this run.
|
||||
sourceIndex *source.DocumentIndex
|
||||
}
|
||||
|
||||
type RunOutput struct {
|
||||
@@ -168,9 +167,8 @@ func (r *Runner) Run(ctx context.Context, input RunInput) (output RunOutput, err
|
||||
if err := source.ValidateDocument(doc); err != nil {
|
||||
return failOutput(output), fmt.Errorf("validate source document: %w", err)
|
||||
}
|
||||
input.cacheSourceIndex = sync.OnceValue(func() source.DocumentIndex {
|
||||
return source.NewDocumentIndex(doc)
|
||||
})
|
||||
index := source.NewDocumentIndex(doc)
|
||||
input.sourceIndex = &index
|
||||
|
||||
if err := writeDebugTimed(debugRecorder, "source/output.json", debugTimedEnvelope{
|
||||
Stage: "source",
|
||||
|
||||
Reference in New Issue
Block a user