Files
yatm/internal/executor/restore/settings.go
T
Samuel Cui 4fef653b71 Prepare YATM v1.0.0-alpha.2
Unify file queries and Scan execution, retain indexed Identical results,
improve Job and Preview workflows, and verify release packaging.
2026-10-05 19:08:49 +08:00

41 lines
1.4 KiB
Go

package restore
import (
"context"
"time"
"github.com/samuelncui/yatm/entity"
"github.com/samuelncui/yatm/internal/executor"
)
// executionSettings is the Restore attempt's pipeline configuration. The runner resolves the
// operator's settings once per attempt and maps each one onto the manifest page size or one ACP
// option: the read buffer, the result queue, the result batch and the result flush interval.
type executionSettings struct {
BatchSize int
ReadBufferMax int
ResultBufferMax int
ResultBatchSize int
ResultFlushInterval time.Duration
}
// executionSettings reads the Job execution settings this attempt runs with. A stored group that
// cannot run is an explicit error, never a silent fallback to defaults the operator did not choose.
func (a *jobRestoreRunner) executionSettings(ctx context.Context) (executionSettings, error) {
settings, err := executor.JobExecutionSettings(ctx)
if err != nil {
return executionSettings{}, err
}
return executionSettingsFrom(settings), nil
}
func executionSettingsFrom(settings *entity.JobExecutionSettings) executionSettings {
return executionSettings{
BatchSize: int(settings.GetReadBatch()),
ReadBufferMax: int(settings.GetReadBufferMax()),
ResultBufferMax: int(settings.GetWriteBufferMax()),
ResultBatchSize: int(settings.GetWriteBatchSize()),
ResultFlushInterval: time.Duration(settings.GetFlushIntervalMs()) * time.Millisecond,
}
}