Files
zeekay 40351cce6f rip: delete temporal fork — native ZAP-only tasksd
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.
2026-04-26 14:06:21 -07:00

97 lines
3.0 KiB
Go

package pauseactivity
import (
"context"
"go.temporal.io/api/workflowservice/v1"
"go.temporal.io/server/api/historyservice/v1"
persistencespb "go.temporal.io/server/api/persistence/v1"
"go.temporal.io/server/common/definition"
"go.temporal.io/server/common/metrics"
"go.temporal.io/server/common/namespace"
"go.temporal.io/server/service/history/api"
"go.temporal.io/server/service/history/consts"
historyi "go.temporal.io/server/service/history/interfaces"
"go.temporal.io/server/service/history/workflow"
"google.golang.org/protobuf/types/known/timestamppb"
)
func Invoke(
ctx context.Context,
request *historyservice.PauseActivityRequest,
shardContext historyi.ShardContext,
workflowConsistencyChecker api.WorkflowConsistencyChecker,
) (resp *historyservice.PauseActivityResponse, retError error) {
err := api.GetAndUpdateWorkflowWithNew(
ctx,
nil,
definition.NewWorkflowKey(
request.NamespaceId,
request.GetFrontendRequest().GetExecution().GetWorkflowId(),
request.GetFrontendRequest().GetExecution().GetRunId(),
),
func(workflowLease api.WorkflowLease) (*api.UpdateWorkflowAction, error) {
mutableState := workflowLease.GetMutableState()
frontendRequest := request.GetFrontendRequest()
var activityIDs []string
switch a := frontendRequest.GetActivity().(type) {
case *workflowservice.PauseActivityRequest_Id:
activityIDs = append(activityIDs, a.Id)
case *workflowservice.PauseActivityRequest_Type:
activityType := a.Type
for _, ai := range mutableState.GetPendingActivityInfos() {
if ai.ActivityType.Name == activityType {
activityIDs = append(activityIDs, ai.ActivityId)
}
}
}
if len(activityIDs) == 0 {
return nil, consts.ErrActivityNotFound
}
pauseInfo := &persistencespb.ActivityInfo_PauseInfo{
PauseTime: timestamppb.New(shardContext.GetTimeSource().Now()),
PausedBy: &persistencespb.ActivityInfo_PauseInfo_Manual_{
Manual: &persistencespb.ActivityInfo_PauseInfo_Manual{
Identity: frontendRequest.GetIdentity(),
Reason: frontendRequest.GetReason(),
},
},
}
for _, activityId := range activityIDs {
err := workflow.PauseActivity(mutableState, activityId, pauseInfo)
if err != nil {
return nil, err
}
}
return &api.UpdateWorkflowAction{
Noop: false,
CreateWorkflowTask: false,
}, nil
},
nil,
shardContext,
workflowConsistencyChecker,
)
if err != nil {
return nil, err
}
targetingMethod := "type"
if _, ok := request.GetFrontendRequest().GetActivity().(*workflowservice.PauseActivityRequest_Id); ok {
targetingMethod = "id"
}
if ns, err := shardContext.GetNamespaceRegistry().GetNamespaceByID(namespace.ID(request.NamespaceId)); err == nil {
metrics.ActivityPauseRequests.With(shardContext.GetMetricsHandler().WithTags(
metrics.NamespaceTag(ns.Name().String()),
metrics.ActivityTargetingMethodTag(targetingMethod),
)).Record(1)
}
return &historyservice.PauseActivityResponse{}, nil
}