mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## 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`.
102 lines
3.5 KiB
Go
102 lines
3.5 KiB
Go
package migration
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.temporal.io/api/workflowservice/v1"
|
|
sdkworker "go.temporal.io/sdk/worker"
|
|
"go.temporal.io/sdk/workflow"
|
|
serverClient "go.temporal.io/server/client"
|
|
"go.temporal.io/server/common/config"
|
|
"go.temporal.io/server/common/headers"
|
|
"go.temporal.io/server/common/log"
|
|
"go.temporal.io/server/common/metrics"
|
|
"go.temporal.io/server/common/namespace"
|
|
"go.temporal.io/server/common/persistence"
|
|
"go.temporal.io/server/common/primitives"
|
|
"go.temporal.io/server/common/resource"
|
|
workercommon "go.temporal.io/server/service/worker/common"
|
|
"go.uber.org/fx"
|
|
)
|
|
|
|
type (
|
|
initParams struct {
|
|
fx.In
|
|
PersistenceConfig *config.Persistence
|
|
ExecutionManager persistence.ExecutionManager
|
|
NamespaceRegistry namespace.Registry
|
|
HistoryClient resource.HistoryClient
|
|
FrontendClient workflowservice.WorkflowServiceClient
|
|
ClientFactory serverClient.Factory
|
|
ClientBean serverClient.Bean
|
|
NamespaceReplicationQueue persistence.NamespaceReplicationQueue
|
|
TaskManager persistence.TaskManager
|
|
Logger log.Logger
|
|
MetricsHandler metrics.Handler
|
|
}
|
|
|
|
fxResult struct {
|
|
fx.Out
|
|
Component workercommon.WorkerComponent `group:"workerComponent"`
|
|
}
|
|
|
|
replicationWorkerComponent struct {
|
|
initParams
|
|
}
|
|
)
|
|
|
|
var Module = fx.Options(
|
|
fx.Provide(NewResult),
|
|
)
|
|
|
|
func NewResult(params initParams) fxResult {
|
|
component := &replicationWorkerComponent{
|
|
initParams: params,
|
|
}
|
|
return fxResult{
|
|
Component: component,
|
|
}
|
|
}
|
|
|
|
func (wc *replicationWorkerComponent) RegisterWorkflow(registry sdkworker.Registry) {
|
|
registry.RegisterWorkflowWithOptions(CatchupWorkflow, workflow.RegisterOptions{Name: catchupWorkflowName})
|
|
registry.RegisterWorkflowWithOptions(ForceReplicationWorkflow, workflow.RegisterOptions{Name: forceReplicationWorkflowName})
|
|
registry.RegisterWorkflowWithOptions(NamespaceHandoverWorkflow, workflow.RegisterOptions{Name: namespaceHandoverWorkflowName})
|
|
registry.RegisterWorkflowWithOptions(ForceTaskQueueUserDataReplicationWorkflow, workflow.RegisterOptions{Name: forceTaskQueueUserDataReplicationWorkflow})
|
|
}
|
|
|
|
func (wc *replicationWorkerComponent) DedicatedWorkflowWorkerOptions() *workercommon.DedicatedWorkerOptions {
|
|
// Use default worker
|
|
return nil
|
|
}
|
|
|
|
func (wc *replicationWorkerComponent) RegisterActivities(registry sdkworker.Registry) {
|
|
registry.RegisterActivity(wc.activities())
|
|
}
|
|
|
|
func (wc *replicationWorkerComponent) DedicatedActivityWorkerOptions() *workercommon.DedicatedWorkerOptions {
|
|
return &workercommon.DedicatedWorkerOptions{
|
|
TaskQueue: primitives.MigrationActivityTQ,
|
|
Options: sdkworker.Options{
|
|
BackgroundActivityContext: headers.SetCallerType(context.Background(), headers.CallerTypePreemptable),
|
|
},
|
|
}
|
|
}
|
|
|
|
func (wc *replicationWorkerComponent) activities() *activities {
|
|
return &activities{
|
|
historyShardCount: wc.PersistenceConfig.NumHistoryShards,
|
|
executionManager: wc.ExecutionManager,
|
|
namespaceRegistry: wc.NamespaceRegistry,
|
|
historyClient: wc.HistoryClient,
|
|
frontendClient: wc.FrontendClient,
|
|
clientFactory: wc.ClientFactory,
|
|
clientBean: wc.ClientBean,
|
|
namespaceReplicationQueue: wc.NamespaceReplicationQueue,
|
|
taskManager: wc.TaskManager,
|
|
logger: wc.Logger,
|
|
metricsHandler: wc.MetricsHandler,
|
|
forceReplicationMetricsHandler: wc.MetricsHandler.WithTags(metrics.WorkflowTypeTag(forceReplicationWorkflowName)),
|
|
}
|
|
}
|