2025-10-02 20:35:53 +03:00
|
|
|
package processor
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
2025-10-03 19:17:01 +03:00
|
|
|
"task-processor/internal/appState"
|
|
|
|
|
"task-processor/internal/parsers"
|
|
|
|
|
"task-processor/internal/shared"
|
2025-10-02 20:35:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Processor struct {
|
|
|
|
|
handlers map[string]parsers.TaskHandler
|
|
|
|
|
out chan shared.TaskResult
|
|
|
|
|
state *appState.State
|
|
|
|
|
ctx context.Context
|
|
|
|
|
numCPUs int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Deps struct {
|
|
|
|
|
Handlers map[string]parsers.TaskHandler
|
|
|
|
|
Out chan shared.TaskResult
|
|
|
|
|
State *appState.State
|
|
|
|
|
Ctx context.Context
|
|
|
|
|
NumCPUs int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func New(deps Deps) *Processor {
|
|
|
|
|
return &Processor{
|
|
|
|
|
handlers: deps.Handlers,
|
|
|
|
|
out: deps.Out,
|
|
|
|
|
state: deps.State,
|
|
|
|
|
ctx: deps.Ctx,
|
|
|
|
|
numCPUs: deps.NumCPUs,
|
|
|
|
|
}
|
|
|
|
|
}
|