Move chunk planning into core operation execution
This commit is contained in:
@@ -37,15 +37,10 @@ var _ contracts.Chunker = (*Chunker)(nil)
|
||||
|
||||
type Options struct{}
|
||||
|
||||
type Chunker struct {
|
||||
engine *promptkit.Engine
|
||||
}
|
||||
type Chunker struct{}
|
||||
|
||||
func New(engine *promptkit.Engine, _ Options) (*Chunker, error) {
|
||||
if engine == nil {
|
||||
return nil, chunkerErrorf("native engine must not be nil")
|
||||
}
|
||||
return &Chunker{engine: engine}, nil
|
||||
func New(_ Options) (*Chunker, error) {
|
||||
return &Chunker{}, nil
|
||||
}
|
||||
|
||||
func (c *Chunker) Key() string {
|
||||
@@ -56,27 +51,24 @@ func (c *Chunker) ReferenceSlots() []contracts.ReferenceSlot {
|
||||
return shared.ReferenceSlots(referenceSlotDescriptions)
|
||||
}
|
||||
|
||||
func (c *Chunker) Plan(ctx context.Context, req contracts.ChunkRequest) (contracts.ChunkPlanResult, error) {
|
||||
func (c *Chunker) PrepareChunk(ctx context.Context, req contracts.ChunkInput) (contracts.PreparedOperation[source.ChunkPlan], error) {
|
||||
if c == nil {
|
||||
return contracts.ChunkPlanResult{}, chunkerErrorf("chunker must not be nil")
|
||||
}
|
||||
if c.engine == nil {
|
||||
return contracts.ChunkPlanResult{}, chunkerErrorf("native engine must not be nil")
|
||||
return nil, chunkerErrorf("chunker must not be nil")
|
||||
}
|
||||
if ctx == nil {
|
||||
return contracts.ChunkPlanResult{}, chunkerErrorf("context must not be nil")
|
||||
return nil, chunkerErrorf("context must not be nil")
|
||||
}
|
||||
if err := ctx.Err(); err != nil {
|
||||
return contracts.ChunkPlanResult{}, chunkerErrorf("context error before chunking: %w", err)
|
||||
return nil, chunkerErrorf("context error before chunking: %w", err)
|
||||
}
|
||||
if req.Source == nil {
|
||||
return contracts.ChunkPlanResult{}, chunkerErrorf("source must not be nil")
|
||||
return nil, chunkerErrorf("source must not be nil")
|
||||
}
|
||||
if len(req.Source.Units) == 0 {
|
||||
return contracts.ChunkPlanResult{}, chunkerErrorf("source units must not be empty")
|
||||
return nil, chunkerErrorf("source units must not be empty")
|
||||
}
|
||||
if err := source.ValidateDocument(req.Source); err != nil {
|
||||
return contracts.ChunkPlanResult{}, chunkerErrorf("validate source document: %w", err)
|
||||
return nil, chunkerErrorf("validate source document: %w", err)
|
||||
}
|
||||
materials := shared.PromptInputs(req.SourceInput, req.References)
|
||||
inputs := make(map[string]promptkit.ArtifactRef, len(materials))
|
||||
@@ -84,23 +76,20 @@ func (c *Chunker) Plan(ctx context.Context, req contracts.ChunkRequest) (contrac
|
||||
inputs[name] = promptkit.InlineWithURI(material.OriginURI, string(material.Content))
|
||||
}
|
||||
initial := promptkit.RunRequest{PromptID: PromptID, ProfileID: req.LLMProfile, SessionID: req.SessionID, Inputs: inputs}
|
||||
plan, outcome, err := pipeline.RunProducer(ctx, c.engine, req.Operation, initial,
|
||||
func(_ context.Context, result *promptkit.RunResult) (*source.ChunkPlan, []string, error) {
|
||||
return contracts.NativeOperation[source.ChunkPlan]{Initial: initial,
|
||||
Interpret: func(_ context.Context, result *promptkit.RunResult) (contracts.Evaluation[source.ChunkPlan], error) {
|
||||
var response chunkResponse
|
||||
if err := json.Unmarshal([]byte(result.RawOutput), &response); err != nil {
|
||||
return nil, nil, chunkerErrorf("decode native output: %w", err)
|
||||
return nil, chunkerErrorf("decode native output: %w", err)
|
||||
}
|
||||
plan, err := planFromResponse(req.Source, response)
|
||||
if err != nil {
|
||||
return nil, []string{fmt.Sprintf("Revise the scene boundaries: %v. Use source-unit IDs from the supplied transcript and cover every unit in document order, without gaps or overlaps.", err)}, nil
|
||||
return contracts.CandidateEvaluation[source.ChunkPlan]{Result: contracts.EvaluationView[source.ChunkPlan]{Guidance: []string{fmt.Sprintf("Revise the scene boundaries: %v. Use source-unit IDs from the supplied transcript and cover every unit in document order, without gaps or overlaps.", err)}}}, nil
|
||||
}
|
||||
return &plan, nil, nil
|
||||
return contracts.CandidateEvaluation[source.ChunkPlan]{Result: contracts.EvaluationView[source.ChunkPlan]{Candidate: &plan}}, nil
|
||||
},
|
||||
func(_ context.Context, guidance []string) (promptkit.RunRequest, error) {
|
||||
return promptkit.RunRequest{PromptID: CorrectionPromptID, ProfileID: req.LLMProfile, SessionID: req.SessionID,
|
||||
Inputs: map[string]promptkit.ArtifactRef{"guidance": promptkit.Inline(strings.Join(guidance, "\n\n"))}}, nil
|
||||
},
|
||||
func(context.Context, *source.ChunkPlan) (source.ChunkPlan, error) {
|
||||
Correction: contracts.PromptCorrection(CorrectionPromptID, "guidance", func(guidance []string) promptkit.ArtifactRef { return promptkit.Inline(strings.Join(guidance, "\n\n")) }),
|
||||
Fallback: func(context.Context, contracts.Evaluation[source.ChunkPlan]) (source.ChunkPlan, error) {
|
||||
plan := source.ChunkPlan{SourceDigest: req.Source.Digest, Ranges: []source.ChunkRange{{
|
||||
StartUnitID: req.Source.Units[0].ID, EndUnitID: req.Source.Units[len(req.Source.Units)-1].ID,
|
||||
}}}
|
||||
@@ -108,11 +97,7 @@ func (c *Chunker) Plan(ctx context.Context, req contracts.ChunkRequest) (contrac
|
||||
return source.ChunkPlan{}, chunkerErrorf("materialize whole-source fallback: %w", err)
|
||||
}
|
||||
return plan, nil
|
||||
})
|
||||
if err != nil {
|
||||
return contracts.ChunkPlanResult{}, chunkerErrorf("produce scene plan: %w", err)
|
||||
}
|
||||
return contracts.ChunkPlanResult{Plan: plan, Outcome: outcome}, nil
|
||||
}}, nil
|
||||
}
|
||||
|
||||
func ModuleSpec() pipeline.ModuleSpec {
|
||||
@@ -133,7 +118,7 @@ func Register(registry *pipeline.ChunkerRegistry) error {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return New(request.Dependencies.Engine, options)
|
||||
return New(options)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -71,10 +71,7 @@ func TestNewModuleSpecAndRegister(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestConstructionRejectsMissingDependencyAndUnknownOptions(t *testing.T) {
|
||||
if _, err := New(nil, Options{}); err == nil || !strings.Contains(err.Error(), "native engine") {
|
||||
t.Fatalf("New(nil) error = %v, want native engine error", err)
|
||||
}
|
||||
func TestConstructionRejectsUnknownOptions(t *testing.T) {
|
||||
if _, err := DecodeOptions(map[string]any{"unexpected": true}); err == nil || !strings.Contains(err.Error(), "unknown option") {
|
||||
t.Fatalf("DecodeOptions() error = %v, want unknown option error", err)
|
||||
}
|
||||
@@ -129,7 +126,7 @@ func TestPlanReturnsAnnotationFreeSceneRangesFromStructuredOutput(t *testing.T)
|
||||
request := chunkRequest()
|
||||
var prepared promptkit.PreparedRun
|
||||
request.Operation.Execution.OnPrepared = func(_ context.Context, value promptkit.PreparedRun) { prepared = value }
|
||||
result, err := newChunker(t, client).Plan(context.Background(), request)
|
||||
result, err := runChunk(context.Background(), newChunker(t, client), request)
|
||||
if err != nil {
|
||||
t.Fatalf("Plan() error = %v, want nil", err)
|
||||
}
|
||||
@@ -154,24 +151,24 @@ func TestPlanReturnsAnnotationFreeSceneRangesFromStructuredOutput(t *testing.T)
|
||||
t.Fatal("full source input missing from native prompt")
|
||||
}
|
||||
|
||||
if result.Plan.SourceDigest != "sha256:source" {
|
||||
t.Fatalf("SourceDigest = %q, want source digest", result.Plan.SourceDigest)
|
||||
if result.Value.SourceDigest != "sha256:source" {
|
||||
t.Fatalf("SourceDigest = %q, want source digest", result.Value.SourceDigest)
|
||||
}
|
||||
wantRanges := []source.ChunkRange{{StartUnitID: 1, EndUnitID: 2}, {StartUnitID: 3, EndUnitID: 4}}
|
||||
if len(result.Plan.Ranges) != len(wantRanges) {
|
||||
t.Fatalf("ranges = %#v, want two", result.Plan.Ranges)
|
||||
if len(result.Value.Ranges) != len(wantRanges) {
|
||||
t.Fatalf("ranges = %#v, want two", result.Value.Ranges)
|
||||
}
|
||||
for i, want := range wantRanges {
|
||||
got := result.Plan.Ranges[i]
|
||||
got := result.Value.Ranges[i]
|
||||
if got.StartUnitID != want.StartUnitID || got.EndUnitID != want.EndUnitID {
|
||||
t.Fatalf("range[%d] = %#v, want %#v", i, result.Plan.Ranges[i], want)
|
||||
t.Fatalf("range[%d] = %#v, want %#v", i, result.Value.Ranges[i], want)
|
||||
}
|
||||
if len(got.Annotations) != 0 {
|
||||
t.Fatalf("range[%d] annotations = %#v, want absent", i, got.Annotations)
|
||||
}
|
||||
}
|
||||
if len(result.Plan.Annotations) != 0 {
|
||||
t.Fatalf("plan annotations = %#v, want absent", result.Plan.Annotations)
|
||||
if len(result.Value.Annotations) != 0 {
|
||||
t.Fatalf("plan annotations = %#v, want absent", result.Value.Annotations)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -196,11 +193,11 @@ func TestPlanUsesDocumentOrderForNonconsecutiveUnitIDs(t *testing.T) {
|
||||
scene(10, 3),
|
||||
scene(20, 20),
|
||||
}}}
|
||||
result, err := newChunker(t, client).Plan(context.Background(), req)
|
||||
result, err := runChunk(context.Background(), newChunker(t, client), req)
|
||||
if err != nil {
|
||||
t.Fatalf("Plan() error = %v, want nil", err)
|
||||
}
|
||||
if got := result.Plan.Ranges; !reflect.DeepEqual(got, []source.ChunkRange{{StartUnitID: 10, EndUnitID: 3}, {StartUnitID: 20, EndUnitID: 20}}) {
|
||||
if got := result.Value.Ranges; !reflect.DeepEqual(got, []source.ChunkRange{{StartUnitID: 10, EndUnitID: 3}, {StartUnitID: 20, EndUnitID: 20}}) {
|
||||
t.Fatalf("ranges = %#v, want source-document order", got)
|
||||
}
|
||||
})
|
||||
@@ -210,7 +207,7 @@ func TestPlanUsesDocumentOrderForNonconsecutiveUnitIDs(t *testing.T) {
|
||||
scene(3, 10),
|
||||
scene(20, 20),
|
||||
}}}
|
||||
_, err := newChunker(t, client).Plan(context.Background(), req)
|
||||
_, err := runChunk(context.Background(), newChunker(t, client), req)
|
||||
if err == nil {
|
||||
t.Fatalf("Plan() error = %v, want document-position reversal", err)
|
||||
}
|
||||
@@ -247,7 +244,7 @@ func TestPlanPassesReferencesAsPromptInputs(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := newChunker(t, client).Plan(context.Background(), req); err != nil {
|
||||
if _, err := runChunk(context.Background(), newChunker(t, client), req); err != nil {
|
||||
t.Fatalf("Plan() error = %v, want nil", err)
|
||||
}
|
||||
var messages string
|
||||
@@ -294,7 +291,7 @@ func TestPlanRejectsInvalidRequests(t *testing.T) {
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
chunker *Chunker
|
||||
chunker *chunkFixture
|
||||
ctx context.Context
|
||||
req contracts.ChunkRequest
|
||||
want string
|
||||
@@ -309,7 +306,7 @@ func TestPlanRejectsInvalidRequests(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
_, err := tt.chunker.Plan(tt.ctx, tt.req)
|
||||
_, err := runChunk(tt.ctx, tt.chunker, tt.req)
|
||||
if err == nil {
|
||||
t.Fatal("Plan() error = nil, want error")
|
||||
}
|
||||
@@ -383,11 +380,11 @@ func TestPlanFromResponseRejectsMalformedSceneRanges(t *testing.T) {
|
||||
func TestPlanWrapsLLMClientError(t *testing.T) {
|
||||
client := &fakeScenesLLMClient{err: errors.New("provider unavailable")}
|
||||
|
||||
_, err := newChunker(t, client).Plan(context.Background(), chunkRequest())
|
||||
_, err := runChunk(context.Background(), newChunker(t, client), chunkRequest())
|
||||
if err == nil {
|
||||
t.Fatal("Plan() error = nil, want LLM error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "dnd scenes") || !strings.Contains(err.Error(), "provider unavailable") {
|
||||
if !strings.Contains(err.Error(), "provider unavailable") {
|
||||
t.Fatalf("Plan() error = %q, want wrapped LLM context", err.Error())
|
||||
}
|
||||
}
|
||||
@@ -414,7 +411,12 @@ func sceneSourceInput() contracts.LLMInputMaterial {
|
||||
return contracts.NewLLMInputMaterial("source", "application/json", []byte(sceneTranscriptJSON), "sha256:transcript", "file:///session-alpha.json")
|
||||
}
|
||||
|
||||
func newChunker(t *testing.T, client promptkit.LLMClient) *Chunker {
|
||||
type chunkFixture struct {
|
||||
*Chunker
|
||||
engine *promptkit.Engine
|
||||
}
|
||||
|
||||
func newChunker(t *testing.T, client promptkit.LLMClient) *chunkFixture {
|
||||
t.Helper()
|
||||
type settings struct {
|
||||
PromptKit promptkit.Settings `yaml:"promptkit"`
|
||||
@@ -438,11 +440,25 @@ func newChunker(t *testing.T, client promptkit.LLMClient) *Chunker {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
chunker, err := New(engine, Options{})
|
||||
chunker, err := New(Options{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return chunker
|
||||
return &chunkFixture{Chunker: chunker, engine: engine}
|
||||
}
|
||||
|
||||
func runChunk(ctx context.Context, fixture *chunkFixture, req contracts.ChunkRequest) (pipeline.OperationResult[source.ChunkPlan], error) {
|
||||
var chunker *Chunker
|
||||
var engine *promptkit.Engine
|
||||
if fixture != nil {
|
||||
chunker, engine = fixture.Chunker, fixture.engine
|
||||
}
|
||||
op := req.Operation
|
||||
execution := pipeline.ExecutionContext[source.ChunkPlan]{Engine: engine, Controls: op.Controls, Assess: op.Assess, Execution: op.Execution, ReuseEligible: op.ReuseEligible, Cache: op.Cache}
|
||||
input := contracts.ChunkInput{Source: req.Source, SourceInput: req.SourceInput, SessionID: req.SessionID, References: req.References, LLMProfile: req.LLMProfile, Metadata: req.Metadata}
|
||||
return pipeline.ExecuteOperation(ctx, execution, func(ctx context.Context) (contracts.PreparedOperation[source.ChunkPlan], error) {
|
||||
return chunker.PrepareChunk(ctx, input)
|
||||
})
|
||||
}
|
||||
|
||||
func sceneSourceDocument() *source.SourceDocument {
|
||||
|
||||
@@ -40,9 +40,9 @@ func TestNativePlanAssessesEveryRevisionThroughTheFinalTurn(t *testing.T) {
|
||||
}
|
||||
return contracts.CandidateAssessment{Validators: findings}, nil
|
||||
}
|
||||
result, err := newChunker(t, client).Plan(context.Background(), request)
|
||||
result, err := runChunk(context.Background(), newChunker(t, client), request)
|
||||
if err != nil || result.Outcome.Disposition != contracts.ProducerAccepted || !result.Outcome.ReuseEligible ||
|
||||
len(result.Plan.Ranges) != 2 || assessments != 3 || len(client.requests) != 3 || len(prepared) != 3 {
|
||||
len(result.Value.Ranges) != 2 || assessments != 3 || len(client.requests) != 3 || len(prepared) != 3 {
|
||||
t.Fatalf("final-turn result=%#v %v, assessments/provider/prepared=%d/%d/%d", result, err, assessments, len(client.requests), len(prepared))
|
||||
}
|
||||
for i, call := range client.requests {
|
||||
@@ -81,7 +81,7 @@ func TestNativePlanCanCorrectAnUnresolvableBoundary(t *testing.T) {
|
||||
_, err := source.MaterializeChunkPlan(request.Source, plan)
|
||||
return contracts.CandidateAssessment{}, err
|
||||
}
|
||||
result, err := newChunker(t, client).Plan(context.Background(), request)
|
||||
result, err := runChunk(context.Background(), newChunker(t, client), request)
|
||||
if err != nil || result.Outcome.Disposition != contracts.ProducerAccepted || assessments != 1 || len(client.requests) != 2 {
|
||||
t.Fatalf("boundary correction=%#v %v, assessments=%d calls=%d", result, err, assessments, len(client.requests))
|
||||
}
|
||||
@@ -106,7 +106,7 @@ func TestPlanExhaustionUsesOnlyAnExplicitWholeSourceFallback(t *testing.T) {
|
||||
Result: contracts.ValidationResult{CorrectionGuidance: "Reconsider the scene transition."},
|
||||
}}}, nil
|
||||
}
|
||||
result, err := newChunker(t, client).Plan(context.Background(), request)
|
||||
result, err := runChunk(context.Background(), newChunker(t, client), request)
|
||||
if assessments != 2 || len(client.requests) != 2 {
|
||||
t.Fatal("revision was omitted, restarted, or reassessed")
|
||||
}
|
||||
@@ -117,10 +117,10 @@ func TestPlanExhaustionUsesOnlyAnExplicitWholeSourceFallback(t *testing.T) {
|
||||
return
|
||||
}
|
||||
want := source.ChunkPlan{SourceDigest: request.Source.Digest, Ranges: []source.ChunkRange{{StartUnitID: 1, EndUnitID: 4}}}
|
||||
if err != nil || !reflect.DeepEqual(result.Plan, want) || result.Outcome.Disposition != contracts.ProducerFallback || result.Outcome.ReuseEligible {
|
||||
if err != nil || !reflect.DeepEqual(result.Value, want) || result.Outcome.Disposition != contracts.ProducerFallback || result.Outcome.ReuseEligible {
|
||||
t.Fatalf("whole-source fallback=%#v %v", result, err)
|
||||
}
|
||||
chunks, err := source.MaterializeChunkPlan(request.Source, result.Plan)
|
||||
chunks, err := source.MaterializeChunkPlan(request.Source, result.Value)
|
||||
if err != nil || len(chunks) != 1 || !reflect.DeepEqual(unitIDs(chunks[0].Units), []int{1, 2, 3, 4}) ||
|
||||
len(chunks[0].Annotations) != 0 || len(chunks[0].PlanAnnotations) != 0 {
|
||||
t.Fatalf("fallback did not materialize the unannotated complete source: %#v %v", chunks, err)
|
||||
@@ -152,12 +152,12 @@ func TestNativePlanFailureUsesDocumentOrderWithoutEarlierPlanRecovery(t *testing
|
||||
Result: contracts.ValidationResult{CorrectionGuidance: "Keep the encounter together."},
|
||||
}}}, nil
|
||||
}
|
||||
result, err := newChunker(t, client).Plan(context.Background(), request)
|
||||
result, err := runChunk(context.Background(), newChunker(t, client), request)
|
||||
if err != nil || result.Outcome.Disposition != contracts.ProducerFallback || result.Outcome.ReuseEligible ||
|
||||
!reflect.DeepEqual(result.Plan.Ranges, []source.ChunkRange{{StartUnitID: 30, EndUnitID: 4}}) {
|
||||
!reflect.DeepEqual(result.Value.Ranges, []source.ChunkRange{{StartUnitID: 30, EndUnitID: 4}}) {
|
||||
t.Fatalf("failure fallback=%#v %v", result, err)
|
||||
}
|
||||
chunks, err := source.MaterializeChunkPlan(request.Source, result.Plan)
|
||||
chunks, err := source.MaterializeChunkPlan(request.Source, result.Value)
|
||||
if err != nil || !reflect.DeepEqual(unitIDs(chunks[0].Units), []int{30, 10, 3, 4}) {
|
||||
t.Fatalf("nonconsecutive source order lost: %#v %v", chunks, err)
|
||||
}
|
||||
@@ -174,7 +174,7 @@ func TestNativeStructuralFailureSkipsSemanticAssessment(t *testing.T) {
|
||||
assessments++
|
||||
return contracts.CandidateAssessment{}, nil
|
||||
}
|
||||
result, err := newChunker(t, client).Plan(context.Background(), request)
|
||||
result, err := runChunk(context.Background(), newChunker(t, client), request)
|
||||
if err != nil || result.Outcome.Disposition != contracts.ProducerFallback || assessments != 0 {
|
||||
t.Fatalf("structural failure=%#v %v", result, err)
|
||||
}
|
||||
@@ -187,7 +187,7 @@ func TestCancellationAndMaterializationFailureDoNotPublishFallback(t *testing.T)
|
||||
client := &fakeScenesLLMClient{response: validSceneResponse(), onGenerate: func(context.Context, promptkit.GenerateRequest) { cancel() }}
|
||||
request := chunkRequest()
|
||||
request.Operation.Controls.Mode = contracts.ModePermissive
|
||||
result, err := newChunker(t, client).Plan(ctx, request)
|
||||
result, err := runChunk(ctx, newChunker(t, client), request)
|
||||
if !errors.Is(err, context.Canceled) || result.Outcome.Disposition != "" || len(client.requests) != 1 {
|
||||
t.Fatalf("cancellation=%#v %v", result, err)
|
||||
}
|
||||
@@ -197,7 +197,7 @@ func TestCancellationAndMaterializationFailureDoNotPublishFallback(t *testing.T)
|
||||
request.Operation.Controls.Mode = contracts.ModePermissive
|
||||
request.Source.Units[0].Metadata = map[string]any{"invalid": math.NaN()}
|
||||
failure := errors.New("provider unavailable")
|
||||
result, err := newChunker(t, &fakeScenesLLMClient{err: failure}).Plan(context.Background(), request)
|
||||
result, err := runChunk(context.Background(), newChunker(t, &fakeScenesLLMClient{err: failure}), request)
|
||||
if err == nil || result.Outcome.Disposition != "" || !errors.Is(err, failure) {
|
||||
t.Fatalf("unusable fallback=%#v %v", result, err)
|
||||
}
|
||||
|
||||
@@ -22,8 +22,9 @@ type pilotChunker struct{}
|
||||
|
||||
func (pilotChunker) Key() string { return "pilot/chunk" }
|
||||
func (pilotChunker) ReferenceSlots() []contracts.ReferenceSlot { return nil }
|
||||
func (pilotChunker) Plan(_ context.Context, request contracts.ChunkRequest) (contracts.ChunkPlanResult, error) {
|
||||
return contracts.ChunkPlanResult{Plan: source.ChunkPlan{SourceDigest: request.Source.Digest, Ranges: []source.ChunkRange{{StartUnitID: request.Source.Units[0].ID, EndUnitID: request.Source.Units[len(request.Source.Units)-1].ID}}}}, nil
|
||||
func (pilotChunker) PrepareChunk(_ context.Context, request contracts.ChunkInput) (contracts.PreparedOperation[source.ChunkPlan], error) {
|
||||
plan := source.ChunkPlan{SourceDigest: request.Source.Digest, Ranges: []source.ChunkRange{{StartUnitID: request.Source.Units[0].ID, EndUnitID: request.Source.Units[len(request.Source.Units)-1].ID}}}
|
||||
return contracts.DeterministicOperation[source.ChunkPlan]{Evaluation: contracts.CandidateEvaluation[source.ChunkPlan]{Result: contracts.EvaluationView[source.ChunkPlan]{Candidate: &plan}}}, nil
|
||||
}
|
||||
|
||||
type pilotMerger struct{}
|
||||
|
||||
Reference in New Issue
Block a user