Files
tasks/cmd/tools/gendynamicconfig/main.go
zeekay 5a601d081b rebrand: go.temporal.io/server -> github.com/hanzoai/tasks
Full module path rebrand from Temporal to Hanzo Tasks:
- go.mod module: github.com/hanzoai/tasks
- All internal Go imports updated (1906 files)
- cmd/server renamed to cmd/tasksd
- Binary name: tasksd (was temporal-server)
- Docker images: hanzoai/tasks (was temporalio/server)
- README rewritten with Hanzo Tasks branding
- LLM.md created with integration notes
- Makefile, goreleaser, CI workflows updated
- go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos)

Fork of Temporal.io (MIT license).
2026-03-19 10:36:40 -07:00

124 lines
2.6 KiB
Go

package main
import (
_ "embed"
"github.com/hanzoai/tasks/cmd/tools/codegen"
)
type (
settingType struct {
Name string
GoType string
IsGeneric bool
}
settingPrecedence struct {
Name string
GoArgs string
Expr string
}
dynamicConfigData struct {
Types []settingType
Precedences []settingPrecedence
}
)
var (
//go:embed dynamic_config.tmpl
dynamicConfigTemplate string
data = dynamicConfigData{
Types: []settingType{
{
Name: "Bool",
GoType: "bool",
},
{
Name: "Int",
GoType: "int",
},
{
Name: "Float",
GoType: "float64",
},
{
Name: "String",
GoType: "string",
},
{
Name: "Duration",
GoType: "time.Duration",
},
{
Name: "Map",
GoType: "map[string]any",
},
{
Name: "Typed",
GoType: "<generic>",
IsGeneric: true, // this one is treated differently
},
},
Precedences: []settingPrecedence{
{
Name: "Global",
GoArgs: "",
Expr: "[]Constraints{{}}",
},
{
Name: "Namespace",
GoArgs: "namespace string",
Expr: "[]Constraints{{Namespace: namespace}, {}}",
},
{
Name: "NamespaceID",
GoArgs: "namespaceID namespace.ID",
Expr: "[]Constraints{{NamespaceID: namespaceID.String()}, {}}",
},
{
Name: "TaskQueue",
GoArgs: "namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType",
// A task-queue-name-only filter applies to a single task queue name across all
// namespaces, with higher precedence than a namespace-only filter. This is intended to
// be used by the default partition count and is probably not useful otherwise.
Expr: `[]Constraints{
{Namespace: namespace, TaskQueueName: taskQueue, TaskQueueType: taskQueueType},
{Namespace: namespace, TaskQueueName: taskQueue},
{TaskQueueName: taskQueue},
{Namespace: namespace},
{},
}`,
},
{
Name: "ShardID",
GoArgs: "shardID int32",
Expr: "[]Constraints{{ShardID: shardID}, {}}",
},
{
Name: "TaskType",
GoArgs: "taskType enumsspb.TaskType",
Expr: "[]Constraints{{TaskType: taskType}, {}}",
},
{
Name: "Destination",
GoArgs: "namespace string, destination string",
Expr: `[]Constraints{
{Namespace: namespace, Destination: destination},
{Destination: destination},
{Namespace: namespace},
{},
}`,
},
{
Name: "ChasmTaskType",
GoArgs: "chasmTaskType string",
Expr: "[]Constraints{{ChasmTaskType: chasmTaskType}, {}}",
},
}}
)
func main() {
codegen.GenerateTemplateToFile(dynamicConfigTemplate, data, "", "setting")
}