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`.
100 lines
2.9 KiB
Go
100 lines
2.9 KiB
Go
package deployment
|
|
|
|
import (
|
|
sdkworker "go.temporal.io/sdk/worker"
|
|
"go.temporal.io/sdk/workflow"
|
|
"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/common/persistence/visibility/manager"
|
|
"go.temporal.io/server/common/resource"
|
|
"go.temporal.io/server/common/sdk"
|
|
workercommon "go.temporal.io/server/service/worker/common"
|
|
"go.uber.org/fx"
|
|
)
|
|
|
|
type (
|
|
workerComponent struct {
|
|
activityDeps activityDeps
|
|
}
|
|
|
|
activityDeps struct {
|
|
fx.In
|
|
MetricsHandler metrics.Handler
|
|
Logger log.Logger
|
|
ClientFactory sdk.ClientFactory
|
|
MatchingClient resource.MatchingClient
|
|
DeploymentClient DeploymentStoreClient
|
|
}
|
|
|
|
fxResult struct {
|
|
fx.Out
|
|
Component workercommon.PerNSWorkerComponent `group:"perNamespaceWorkerComponent"`
|
|
}
|
|
)
|
|
|
|
var Module = fx.Options(
|
|
fx.Provide(NewResult),
|
|
fx.Provide(DeploymentStoreClientProvider),
|
|
)
|
|
|
|
func DeploymentStoreClientProvider(
|
|
logger log.Logger,
|
|
historyClient resource.HistoryClient,
|
|
visibilityManager manager.VisibilityManager,
|
|
dc *dynamicconfig.Collection,
|
|
) DeploymentStoreClient {
|
|
return &DeploymentClientImpl{
|
|
logger: logger,
|
|
historyClient: historyClient,
|
|
visibilityManager: visibilityManager,
|
|
maxIDLengthLimit: dynamicconfig.MaxIDLengthLimit.Get(dc),
|
|
visibilityMaxPageSize: dynamicconfig.FrontendVisibilityMaxPageSize.Get(dc),
|
|
reachabilityCache: newReachabilityCache(
|
|
metrics.NoopMetricsHandler,
|
|
visibilityManager,
|
|
dynamicconfig.ReachabilityCacheOpenWFsTTL.Get(dc)(),
|
|
dynamicconfig.ReachabilityCacheClosedWFsTTL.Get(dc)(),
|
|
),
|
|
maxTaskQueuesInDeployment: dynamicconfig.MatchingMaxTaskQueuesInDeployment.Get(dc),
|
|
}
|
|
}
|
|
|
|
func NewResult(
|
|
dc *dynamicconfig.Collection,
|
|
params activityDeps,
|
|
) fxResult {
|
|
return fxResult{
|
|
Component: &workerComponent{
|
|
activityDeps: params,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (s *workerComponent) DedicatedWorkerOptions(ns *namespace.Namespace) *workercommon.PerNSDedicatedWorkerOptions {
|
|
return &workercommon.PerNSDedicatedWorkerOptions{
|
|
Enabled: true,
|
|
}
|
|
}
|
|
|
|
func (s *workerComponent) Register(registry sdkworker.Registry, ns *namespace.Namespace, details workercommon.RegistrationDetails) func() {
|
|
registry.RegisterWorkflowWithOptions(DeploymentWorkflow, workflow.RegisterOptions{Name: DeploymentWorkflowType})
|
|
registry.RegisterWorkflowWithOptions(DeploymentSeriesWorkflow, workflow.RegisterOptions{Name: DeploymentSeriesWorkflowType})
|
|
|
|
deploymentActivities := &DeploymentActivities{
|
|
namespace: ns,
|
|
deploymentClient: s.activityDeps.DeploymentClient,
|
|
matchingClient: s.activityDeps.MatchingClient,
|
|
}
|
|
registry.RegisterActivity(deploymentActivities)
|
|
|
|
deploymentSeriesActivities := &DeploymentSeriesActivities{
|
|
namespace: ns,
|
|
deploymentClient: s.activityDeps.DeploymentClient,
|
|
}
|
|
registry.RegisterActivity(deploymentSeriesActivities)
|
|
|
|
return nil
|
|
}
|