Files
tasks/service/history/queues/executable_factory.go
Alex ShtinandGitHub 8e8f1b0f7c Remove license header from every file (#7689)
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.

## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
2025-05-01 18:50:21 -07:00

104 lines
3.5 KiB
Go

package queues
import (
"go.opentelemetry.io/otel/trace"
"go.temporal.io/server/common/clock"
"go.temporal.io/server/common/cluster"
"go.temporal.io/server/common/dynamicconfig"
"go.temporal.io/server/common/log"
"go.temporal.io/server/common/metrics"
"go.temporal.io/server/common/namespace"
"go.temporal.io/server/service/history/tasks"
)
type (
// ExecutableFactory and the related interfaces here are needed to make it possible to extend the functionality of
// task processing without changing its core logic. This is similar to ExecutorWrapper.
ExecutableFactory interface {
NewExecutable(task tasks.Task, readerID int64) Executable
}
// ExecutableFactoryFn is a convenience type to avoid having to create a struct that implements ExecutableFactory.
ExecutableFactoryFn func(readerID int64, t tasks.Task) Executable
executableFactoryImpl struct {
executor Executor
scheduler Scheduler
rescheduler Rescheduler
priorityAssigner PriorityAssigner
timeSource clock.TimeSource
namespaceRegistry namespace.Registry
clusterMetadata cluster.Metadata
logger log.Logger
metricsHandler metrics.Handler
tracer trace.Tracer
dlqWriter *DLQWriter
dlqEnabled dynamicconfig.BoolPropertyFn
attemptsBeforeSendingToDlq dynamicconfig.IntPropertyFn
dlqInternalErrors dynamicconfig.BoolPropertyFn
dlqErrorPattern dynamicconfig.StringPropertyFn
}
)
func (f ExecutableFactoryFn) NewExecutable(task tasks.Task, readerID int64) Executable {
return f(readerID, task)
}
func NewExecutableFactory(
executor Executor,
scheduler Scheduler,
rescheduler Rescheduler,
priorityAssigner PriorityAssigner,
timeSource clock.TimeSource,
namespaceRegistry namespace.Registry,
clusterMetadata cluster.Metadata,
logger log.Logger,
metricsHandler metrics.Handler,
tracer trace.Tracer,
dlqWriter *DLQWriter,
dlqEnabled dynamicconfig.BoolPropertyFn,
attemptsBeforeSendingToDlq dynamicconfig.IntPropertyFn,
dlqInternalErrors dynamicconfig.BoolPropertyFn,
dlqErrorPattern dynamicconfig.StringPropertyFn,
) *executableFactoryImpl {
return &executableFactoryImpl{
executor: executor,
scheduler: scheduler,
rescheduler: rescheduler,
priorityAssigner: priorityAssigner,
timeSource: timeSource,
namespaceRegistry: namespaceRegistry,
clusterMetadata: clusterMetadata,
logger: logger,
metricsHandler: metricsHandler.WithTags(defaultExecutableMetricsTags...),
tracer: tracer,
dlqWriter: dlqWriter,
dlqEnabled: dlqEnabled,
attemptsBeforeSendingToDlq: attemptsBeforeSendingToDlq,
dlqInternalErrors: dlqInternalErrors,
dlqErrorPattern: dlqErrorPattern,
}
}
func (f *executableFactoryImpl) NewExecutable(task tasks.Task, readerID int64) Executable {
return NewExecutable(
readerID,
task,
f.executor,
f.scheduler,
f.rescheduler,
f.priorityAssigner,
f.timeSource,
f.namespaceRegistry,
f.clusterMetadata,
f.logger,
f.metricsHandler,
f.tracer,
func(params *ExecutableParams) {
params.DLQEnabled = f.dlqEnabled
params.DLQWriter = f.dlqWriter
params.MaxUnexpectedErrorAttempts = f.attemptsBeforeSendingToDlq
params.DLQInternalErrors = f.dlqInternalErrors
params.DLQErrorPattern = f.dlqErrorPattern
},
)
}