mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-30 14:56:19 +00:00
Goes from 135 MB binary with 1153 files importing go.temporal.io and 224
importing google.golang.org/grpc to a 10 MB native binary with ZERO of
either.
Deleted:
- tasks/, tasktests/, service/, chasm/, client/, api/, proto/, tools/
- cmd/tools/, components/, docker/
- schema/{cassandra,elasticsearch,mysql,postgresql,sqlite}/
- 40 tainted common/ subdirs + 7 top-level common files
- tests/testutils (no longer referenced after surviving deps drop common)
New cmd/tasksd (~100 lines) boots tasks.Embed (zap.Node) + http.Server.
New pkg/tasks/embed.go registers ZAP handlers for the SDK opcode surface
(0x0060-0x00A5). Workflow handlers return a 501 "not yet implemented"
envelope; native engine lands behind this contract.
Build: go build ./cmd/tasksd → 10 MB
Vet: go vet ./... → clean
Boot: tasksd --zap-port 9999 --http :7243
Probes: /healthz, /v1/tasks/health → 200
UI: /_/tasks/, / → 200 (embedded Vite bundle)
ZAP: _tasks._tcp on :9999 (mDNS disabled; direct connect)
go.mod: tidy. No go.temporal.io. No google.golang.org/grpc.
107 lines
2.5 KiB
Go
107 lines
2.5 KiB
Go
package workflow
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"go.temporal.io/api/serviceerror"
|
|
persistencespb "go.temporal.io/server/api/persistence/v1"
|
|
"go.temporal.io/server/chasm"
|
|
historyi "go.temporal.io/server/service/history/interfaces"
|
|
"go.temporal.io/server/service/history/tasks"
|
|
)
|
|
|
|
var _ historyi.ChasmTree = (*noopChasmTree)(nil)
|
|
|
|
var NoopChasmTree = &noopChasmTree{}
|
|
|
|
type noopChasmTree struct{}
|
|
|
|
func (*noopChasmTree) CloseTransaction() (chasm.NodesMutation, error) {
|
|
return chasm.NodesMutation{}, nil
|
|
}
|
|
|
|
func (*noopChasmTree) Snapshot(*persistencespb.VersionedTransition) chasm.NodesSnapshot {
|
|
return chasm.NodesSnapshot{}
|
|
}
|
|
|
|
func (*noopChasmTree) ApplySystemMutation(chasm.NodesMutation) error {
|
|
return nil
|
|
}
|
|
|
|
func (*noopChasmTree) ApplyMutation(chasm.NodesMutation) error {
|
|
return nil
|
|
}
|
|
|
|
func (*noopChasmTree) ApplySnapshot(chasm.NodesSnapshot) error {
|
|
return nil
|
|
}
|
|
|
|
func (*noopChasmTree) RefreshTasks() error {
|
|
return nil
|
|
}
|
|
|
|
func (*noopChasmTree) IsStateDirty() bool {
|
|
return false
|
|
}
|
|
|
|
func (*noopChasmTree) IsDirty() bool {
|
|
return false
|
|
}
|
|
|
|
func (*noopChasmTree) Terminate(chasm.TerminateComponentRequest) error {
|
|
return nil
|
|
}
|
|
|
|
func (*noopChasmTree) Archetype() (chasm.Archetype, error) {
|
|
return chasm.WorkflowArchetype, nil
|
|
}
|
|
|
|
func (*noopChasmTree) ArchetypeID() chasm.ArchetypeID {
|
|
return chasm.WorkflowArchetypeID
|
|
}
|
|
|
|
func (*noopChasmTree) EachPureTask(
|
|
deadline time.Time,
|
|
callback func(executor chasm.NodePureTask, taskAttributes chasm.TaskAttributes, task any) (bool, error),
|
|
) error {
|
|
return nil
|
|
}
|
|
|
|
func (*noopChasmTree) IsStale(chasm.ComponentRef) error {
|
|
return nil
|
|
}
|
|
|
|
func (*noopChasmTree) Component(chasm.Context, chasm.ComponentRef) (chasm.Component, error) {
|
|
return nil, serviceerror.NewInternal("Component() method invoked on noop CHASM tree")
|
|
}
|
|
|
|
func (*noopChasmTree) ComponentByPath(chasm.Context, []string) (chasm.Component, error) {
|
|
return nil, serviceerror.NewInternal("ComponentByPath() method invoked on noop CHASM tree")
|
|
}
|
|
|
|
func (*noopChasmTree) ExecuteSideEffectTask(
|
|
ctx context.Context,
|
|
executionKey chasm.ExecutionKey,
|
|
task *tasks.ChasmTask,
|
|
validate func(chasm.NodeBackend, chasm.Context, chasm.Component) error,
|
|
) error {
|
|
return nil
|
|
}
|
|
|
|
func (*noopChasmTree) ExecuteSideEffectDiscardTask(
|
|
ctx context.Context,
|
|
executionKey chasm.ExecutionKey,
|
|
task *tasks.ChasmTask,
|
|
validate func(chasm.NodeBackend, chasm.Context, chasm.Component) error,
|
|
) error {
|
|
return nil
|
|
}
|
|
|
|
func (*noopChasmTree) ValidateSideEffectTask(
|
|
ctx context.Context,
|
|
task *tasks.ChasmTask,
|
|
) (bool, error) {
|
|
return false, nil
|
|
}
|