Files
tasks/common/persistence/visibility/store/visibility_store.go
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

138 lines
5.3 KiB
Go

package store
// -aux_files is required here due to Closeable interface being in another file.
//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination visibility_store_mock.go -aux_files go.temporal.io/server/common/persistence=../../data_interfaces.go
import (
"context"
"time"
commonpb "go.temporal.io/api/common/v1"
enumspb "go.temporal.io/api/enums/v1"
"go.temporal.io/server/api/visibilityservice/v1"
"go.temporal.io/server/common/persistence"
"go.temporal.io/server/common/persistence/visibility/manager"
)
type (
// VisibilityStore is the store interface for visibility
VisibilityStore interface {
persistence.Closeable
GetName() string
GetIndexName() string
// Validate search attributes based on the store constraints. It returns a new map containing
// only search attributes with valid values. If there are invalid values, it returns error of type
// serviceerror.InvalidArgument.
ValidateCustomSearchAttributes(searchAttributes map[string]any) (map[string]any, error)
// Write APIs.
RecordWorkflowExecutionStarted(ctx context.Context, request *InternalRecordWorkflowExecutionStartedRequest) error
RecordWorkflowExecutionClosed(ctx context.Context, request *InternalRecordWorkflowExecutionClosedRequest) error
UpsertWorkflowExecution(ctx context.Context, request *InternalUpsertWorkflowExecutionRequest) error
DeleteWorkflowExecution(ctx context.Context, request *manager.VisibilityDeleteWorkflowExecutionRequest) error
// Read APIs.
ListWorkflowExecutions(ctx context.Context, request *manager.ListWorkflowExecutionsRequestV2) (*InternalListExecutionsResponse, error)
CountWorkflowExecutions(ctx context.Context, request *manager.CountWorkflowExecutionsRequest) (*InternalCountExecutionsResponse, error)
GetWorkflowExecution(ctx context.Context, request *manager.GetWorkflowExecutionRequest) (*InternalGetWorkflowExecutionResponse, error)
ListChasmExecutions(ctx context.Context, request *visibilityservice.ListChasmExecutionsRequest) (*InternalListExecutionsResponse, error)
CountChasmExecutions(ctx context.Context, request *visibilityservice.CountChasmExecutionsRequest) (*InternalCountExecutionsResponse, error)
// Admin APIs
// AddSearchAttributes makes schema changes to add the search attributes. This function must be
// idempotent, ie., if a search attribute already exists, this function must be no-op, and must
// not return any error.
AddSearchAttributes(ctx context.Context, request *manager.AddSearchAttributesRequest) error
}
// InternalExecutionInfo is internal visibility info for workflow execution
InternalExecutionInfo struct {
WorkflowID string
RunID string
TypeName string
StartTime time.Time
ExecutionTime time.Time
CloseTime time.Time
ExecutionDuration time.Duration
Status enumspb.WorkflowExecutionStatus
HistoryLength int64
HistorySizeBytes int64
StateTransitionCount int64
Memo *commonpb.DataBlob
TaskQueue string
SearchAttributes *commonpb.SearchAttributes
ParentWorkflowID string
ParentRunID string
RootWorkflowID string
RootRunID string
}
// InternalListExecutionsResponse is response from ListWorkflowExecutions and ListChasmExecutions
InternalListExecutionsResponse struct {
Executions []*InternalExecutionInfo
// Token to read next page if there are more workflow executions beyond page size.
// Use this to set NextPageToken on ListWorkflowExecutionsRequest to read the next page.
NextPageToken []byte
}
// InternalCountExecutionsResponse is response from CountWorkflowExecutions and CountChasmExecutions
InternalCountExecutionsResponse struct {
Count int64
Groups []InternalAggregationGroup
}
// InternalAggregationGroup represents a GROUP BY aggregation result
InternalAggregationGroup struct {
GroupValues []*commonpb.Payload
Count int64
}
// InternalGetWorkflowExecutionResponse is response from GetWorkflowExecution
InternalGetWorkflowExecutionResponse struct {
Execution *InternalExecutionInfo
}
// InternalVisibilityRequestBase is a base request to visibility APIs.
InternalVisibilityRequestBase struct {
NamespaceID string
WorkflowID string
RunID string
WorkflowTypeName string
StartTime time.Time
Status enumspb.WorkflowExecutionStatus
ExecutionTime time.Time
TaskID int64
ShardID int32
Memo *commonpb.DataBlob
TaskQueue string
SearchAttributes *commonpb.SearchAttributes
ParentWorkflowID *string
ParentRunID *string
RootWorkflowID string
RootRunID string
}
// InternalRecordWorkflowExecutionStartedRequest request to RecordWorkflowExecutionStarted
InternalRecordWorkflowExecutionStartedRequest struct {
*InternalVisibilityRequestBase
}
// InternalRecordWorkflowExecutionClosedRequest is request to RecordWorkflowExecutionClosed
InternalRecordWorkflowExecutionClosedRequest struct {
*InternalVisibilityRequestBase
CloseTime time.Time
HistoryLength int64
HistorySizeBytes int64
ExecutionDuration time.Duration
StateTransitionCount int64
}
// InternalUpsertWorkflowExecutionRequest is request to UpsertWorkflowExecution
InternalUpsertWorkflowExecutionRequest struct {
*InternalVisibilityRequestBase
}
)