Atlas › Test

token_to_long

Exact test identity: go.temporal.io/server/components/nexusoperations/TestProcessInvocationTask/token_to_long

Package
go.temporal.io/server/components/nexusoperations
Suite / test hierarchy
TestProcessInvocationTask/token_to_long
Test
token_to_long
Introduced at
executors.go ×4 Frontier kind: Joint frontier
Covered ranges
894
Covered lines
4130
Covered files
153

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/components/nexusoperations/executors.go 328 covered LOC · 97 ranges

Open complete file

74 registry *hsm.Registry,
75 options TaskExecutorOptions,
76 > ) error { executors.go
77 > exec := taskExecutor{options}
78 > if err := hsm.RegisterImmediateExecutor(
79 > registry,
80 > exec.executeInvocationTask,
81 > ); err != nil {
82 return err
83 }
84 > if err := hsm.RegisterTimerExecutor( executors.go
85 > registry,
86 > exec.executeBackoffTask,
87 > ); err != nil {
88 return err
89 }
90 > if err := hsm.RegisterTimerExecutor( executors.go
91 > registry,
92 > exec.executeScheduleToCloseTimeoutTask,
93 > ); err != nil {
94 return err
95 }
96 > if err := hsm.RegisterTimerExecutor( executors.go
97 > registry,
98 > exec.executeScheduleToStartTimeoutTask,
99 > ); err != nil {
100 return err
101 }
102 > if err := hsm.RegisterTimerExecutor( executors.go
103 > registry,
104 > exec.executeStartToCloseTimeoutTask,
105 > ); err != nil {
106 return err
107 }
108 > if err := hsm.RegisterImmediateExecutor( executors.go
109 > registry,
110 > exec.executeCancelationTask,
111 > ); err != nil {
112 return err
113 }
114 > return hsm.RegisterTimerExecutor( executors.go
115 > registry,
116 > exec.executeCancelationBackoffTask,
117 > )
118 }
119
127 ns *namespace.Namespace,
128 endpoint *persistencespb.NexusEndpointEntry,
129 > ) (string, error) { executors.go
130 > if endpoint == nil {
131 return commonnexus.SystemCallbackURL, nil
132 }
133 > target := endpoint.GetEndpoint().GetSpec().GetTarget().GetVariant() executors.go
134 > if !useSystemCallback {
135 return buildCallbackFromTemplate(callbackTemplate, ns)
136 }
137 > switch target.(type) { executors.go
138 case *persistencespb.NexusEndpointTarget_Worker_:
139 return commonnexus.SystemCallbackURL, nil
140 > case *persistencespb.NexusEndpointTarget_External_: executors.go
141 > return buildCallbackFromTemplate(callbackTemplate, ns)
142 default:
143 return "", fmt.Errorf("unknown endpoint target type: %T", target)
145 }
146
147 > func buildCallbackFromTemplate(callbackTemplate string, ns *namespace.Namespace) (string, error) { executors.go
148 > if callbackTemplate == "unset" {
149 return "", serviceerror.NewInternalf("dynamic config %q is unset", CallbackURLTemplate.Key().String())
150 }
151 > callbackURLTemplate, err := template.New("NexusCallbackURL").Parse(callbackTemplate) executors.go
152 > if err != nil {
153 return "", fmt.Errorf("failed to parse callback URL template: %w", err)
154 }
155 > builder := &strings.Builder{} executors.go
156 > err = callbackURLTemplate.Execute(builder, struct{ NamespaceName, NamespaceID string }{
157 > NamespaceName: ns.Name().String(),
158 > NamespaceID: ns.ID().String(),
159 > })
160 > if err != nil {
161 return "", fmt.Errorf("failed to format callback URL: %w", err)
162 }
163 > return builder.String(), nil executors.go
164 }
165
166 > func (e taskExecutor) executeInvocationTask(ctx context.Context, env hsm.Environment, ref hsm.Ref, task InvocationTask) error { executors.go
167 > ns, err := e.NamespaceRegistry.GetNamespaceByID(namespace.ID(ref.WorkflowKey.NamespaceID))
168 > if err != nil {
169 return fmt.Errorf("failed to get namespace by ID: %w", err)
170 }
171 > args, err := e.loadOperationArgs(ctx, ns, env, ref) executors.go
172 > if err != nil {
173 return fmt.Errorf("failed to load operation args: %w", err)
174 }
175 > var endpoint *persistencespb.NexusEndpointEntry executors.go
176 >
177 > // Skip endpoint lookup for system-internal operations.
178 > if args.endpointName != commonnexus.SystemEndpoint {
179 > // This happens when we accept the ScheduleNexusOperation command when the endpoint is not found in the registry as executors.go
180 > // indicated by the EndpointNotFoundAlwaysNonRetryable dynamic config.
181 > // The config has been removed but we keep this check for backward compatibility.
182 > if args.endpointID == "" {
183 handlerError := nexus.NewHandlerErrorf(nexus.HandlerErrorTypeNotFound, "endpoint not registered")
184 return e.saveResult(ctx, env, ref, nil, handlerError)
185 }
186
187 > endpoint, err = e.lookupEndpoint(ctx, namespace.ID(ref.WorkflowKey.NamespaceID), args.endpointID, args.endpointName) executors.go
188 > if err != nil {
189 if errors.As(err, new(*serviceerror.NotFound)) {
190 // The endpoint is not registered, immediately fail the invocation.
196 }
197
198 > callbackURL, err := buildCallbackURL(e.Config.UseSystemCallbackURL(), e.Config.CallbackURLTemplate(), ns, endpoint) executors.go
199 > if err != nil {
200 return fmt.Errorf("failed to build callback URL: %w", err)
201 }
205 // Operation machine has transitioned.
206 // TODO(bergundy): Remove this before the 1.27 release.
207 > smRef := common.CloneProto(ref.StateMachineRef) executors.go
208 > smRef.MachineTransitionCount = 0
209 >
210 > // Set ms VT to initial version because workflow may switch to a different branch.
211 > smRef.MutableStateVersionedTransition = smRef.MachineInitialVersionedTransition
212 >
213 > token, err := e.CallbackTokenGenerator.Tokenize(&tokenspb.NexusOperationCompletion{
214 > NamespaceId: ref.WorkflowKey.NamespaceID,
215 > WorkflowId: ref.WorkflowKey.WorkflowID,
216 > RunId: ref.WorkflowKey.RunID,
217 > Ref: smRef,
218 > RequestId: args.requestID,
219 > })
220 > if err != nil {
221 return fmt.Errorf("%w: %w", queueserrors.NewUnprocessableTaskError("failed to generate a callback token"), err)
222 }
223
224 > callTimeout := e.Config.RequestTimeout(ns.Name().String(), task.EndpointName) executors.go
225 > var timeoutType enumspb.TimeoutType
226 > // Adjust timeout based on remaining operation timeouts.
227 > // ScheduleToStart takes precedence over ScheduleToClose since it is already capped by it.
228 > if args.scheduleToStartTimeout > 0 {
229 callTimeout = min(callTimeout, args.scheduleToStartTimeout-time.Since(args.scheduledTime))
230 timeoutType = enumspb.TIMEOUT_TYPE_SCHEDULE_TO_START
231 > } else if args.scheduleToCloseTimeout > 0 { executors.go
232 callTimeout = min(callTimeout, args.scheduleToCloseTimeout-time.Since(args.scheduledTime))
233 timeoutType = enumspb.TIMEOUT_TYPE_SCHEDULE_TO_CLOSE
235 // Inform the handler of the operation timeout via header.
236 // StartToClose takes precedence over ScheduleToClose since it is already capped by it.
237 > opTimeout := maxDuration executors.go
238 > if args.startToCloseTimeout > 0 {
239 opTimeout = args.startToCloseTimeout
240 }
241 > if args.scheduleToCloseTimeout > 0 { executors.go
242 opTimeout = min(args.scheduleToCloseTimeout-time.Since(args.scheduledTime), opTimeout)
243 }
244 > header := nexus.Header(args.header) executors.go
245 > if header == nil {
246 > header = make(nexus.Header, 1) // It's most likely that we'll only be setting the new wire format header. executors.go
247 > }
248 // Set the operation timeout header if not already set.
249 > if opTimeoutHeader := header.Get(nexus.HeaderOperationTimeout); opTimeout != maxDuration && opTimeoutHeader == "" { executors.go
250 header[nexus.HeaderOperationTimeout] = commonnexus.FormatDuration(opTimeout)
251 }
252 > if e.Config.UseNewFailureWireFormat(ns.Name().String()) { executors.go
253 > // If this request is handled by a newer server that supports Nexus failure serialization, trigger that behavior. executors.go
254 > header.Set(nexusrpc.HeaderTemporalNexusFailureSupport, "true")
255 > }
256
257 > callCtx, cancel := context.WithTimeout(ctx, callTimeout) executors.go
258 > defer cancel()
259 > // Set this value on the parent context so that our custom HTTP caller can mutate it since we cannot access response headers directly.
260 > callCtx = context.WithValue(callCtx, commonnexus.FailureSourceContextKey, &atomic.Value{})
261 >
262 > options := nexus.StartOperationOptions{
263 > Header: header,
264 > CallbackURL: callbackURL,
265 > RequestID: args.requestID,
266 > CallbackHeader: nexus.Header{
267 > commonnexus.CallbackTokenHeader: token,
268 > },
269 > Links: []nexus.Link{args.nexusLink},
270 > }
271 >
272 > var result *nexusrpc.ClientStartOperationResponse[*commonpb.Payload]
273 > var callErr error
274 > var startTime time.Time
275 > if callTimeout < e.Config.MinRequestTimeout(ns.Name().String()) {
276 startTime = time.Now()
277 callErr = &operationTimeoutBelowMinError{timeoutType: timeoutType}
278 > } else if args.endpointName == commonnexus.SystemEndpoint { executors.go
279 startTime = time.Now()
280 result, callErr = e.startOnHistoryService(callCtx, ns, args, options)
281 > } else { executors.go
282 > client, err := e.ClientProvider( executors.go
283 > callCtx,
284 > ns.ID().String(),
285 > endpoint,
286 > args.service,
287 > )
288 > if err != nil {
289 return fmt.Errorf("failed to get a client: %w", err)
290 }
291
292 > if e.HTTPTraceProvider != nil { executors.go
293 traceLogger := log.With(e.Logger,
294 tag.Operation("StartOperation"),
306 }
307 }
308 > startTime = time.Now() executors.go
309 > result, callErr = e.startViaHTTP(callCtx, client, args, options)
310 }
311
312 > if result != nil { executors.go
313 > tokenLimit := e.Config.MaxOperationTokenLength(ns.Name().String()) executors.go
314 > if result.Pending != nil && len(result.Pending.Token) > tokenLimit {
315 > callErr = fmt.Errorf("%w: length exceeds allowed limit (%d/%d)", ErrInvalidOperationToken, len(result.Pending.Token), tokenLimit) executors.go
316 > } else if result.Successful != nil && result.Successful.Size() > e.Config.PayloadSizeLimit(ns.Name().String()) { executors.go
317 callErr = ErrResponseBodyTooLarge
318 }
319 }
320 > failureSource := failureSourceFromContext(callCtx) executors.go
321 >
322 > methodTag := metrics.NexusMethodTag("StartOperation")
323 > namespaceTag := metrics.NamespaceTag(ns.Name().String())
324 > var destTag metrics.Tag
325 > if endpoint != nil {
326 > destTag = metrics.DestinationTag(endpoint.Endpoint.Spec.GetName()) executors.go
327 > } else { executors.go
328 destTag = metrics.DestinationTag(args.endpointName)
329 }
330 > outcomeTag := metrics.OutcomeTag(startCallOutcomeTag(callCtx, result, callErr)) executors.go
331 > failureSourceTag := metrics.FailureSourceTag(failureSource)
332 > chasmnexus.OutboundRequestCounter.With(e.MetricsHandler).Record(1, namespaceTag, destTag, methodTag, outcomeTag, failureSourceTag)
333 > chasmnexus.OutboundRequestLatency.With(e.MetricsHandler).Record(time.Since(startTime), namespaceTag, destTag, methodTag, outcomeTag, failureSourceTag)
334 >
335 > if callErr != nil {
336 > if failureSource == commonnexus.FailureSourceWorker || errors.As(callErr, new(*operationTimeoutBelowMinError)) { executors.go
337 e.Logger.Debug("Nexus StartOperation request failed", tag.Error(callErr))
338 > } else { executors.go
339 > e.Logger.Error("Nexus StartOperation request failed", tag.Error(callErr)) executors.go
340 > }
341 }
342
343 > err = e.saveResult(ctx, env, ref, result, callErr) executors.go
344 >
345 > if callErr != nil && isDestinationDown(callErr) {
346 err = queueserrors.NewDestinationDownError(callErr.Error(), err)
347 }
348
349 > return err executors.go
350 }
351
371 env hsm.Environment,
372 ref hsm.Ref,
373 > ) (args startArgs, err error) { executors.go
374 > var eventToken []byte
375 > err = env.Access(ctx, ref, hsm.AccessRead, func(node *hsm.Node) error {
376 > operation, err := hsm.MachineData[Operation](node)
377 > if err != nil {
378 return err
379 }
380
381 > args.endpointName = operation.Endpoint executors.go
382 > args.endpointID = operation.EndpointId
383 > args.service = operation.Service
384 > args.operation = operation.Operation
385 > args.requestID = operation.RequestId
386 > args.scheduledTime = operation.ScheduledTime.AsTime()
387 > args.scheduleToCloseTimeout = operation.ScheduleToCloseTimeout.AsDuration()
388 > args.scheduleToStartTimeout = operation.ScheduleToStartTimeout.AsDuration()
389 > args.startToCloseTimeout = operation.StartToCloseTimeout.AsDuration()
390 > eventToken = operation.ScheduledEventToken
391 > event, err := node.LoadHistoryEvent(ctx, eventToken)
392 > if err != nil {
393 return err
394 }
395 > attrs := event.GetNexusOperationScheduledEventAttributes() executors.go
396 > args.payload = attrs.GetInput()
397 > args.header = maps.Clone(attrs.GetNexusHeader())
398 > args.nexusLink = commonnexus.ConvertLinkWorkflowEventToNexusLink(&commonpb.Link_WorkflowEvent{
399 > Namespace: ns.Name().String(),
400 > WorkflowId: ref.WorkflowKey.WorkflowID,
401 > RunId: ref.WorkflowKey.RunID,
402 > Reference: &commonpb.Link_WorkflowEvent_EventRef{
403 > EventRef: &commonpb.Link_WorkflowEvent_EventReference{
404 > EventId: event.GetEventId(),
405 > EventType: event.GetEventType(),
406 > },
407 > },
408 > })
409 > args.namespaceFailoverVersion = event.Version
410 > return nil
411 })
412 > return executors.go
413 }
414
415 > func (e taskExecutor) saveResult(ctx context.Context, env hsm.Environment, ref hsm.Ref, result *nexusrpc.ClientStartOperationResponse[*commonpb.Payload], callErr error) error { executors.go
416 > // emitMetrics is derived from the operation's resulting state inside the Access closure and
417 > // invoked only after the write transaction commits successfully, so a failed commit (which
418 > // retries the task) does not double-count the metric. See operationMetricsHandler's doc comment.
419 > var emitMetrics func()
420 > err := env.Access(ctx, ref, hsm.AccessWrite, func(node *hsm.Node) error {
421 > operation, err := hsm.MachineData[Operation](node)
422 > if err != nil {
423 return err
424 }
425 > switch { executors.go
426 > case callErr != nil: executors.go
427 > err = e.handleStartOperationError(env, node, operation, callErr)
428 case result.Pending != nil:
429 err = e.saveStartedResult(env, node, operation, result)
433 err = handleSuccessfulOperationResult(node, operation, result.Successful, links)
434 }
435 > if err != nil { executors.go
436 return err
437 }
438 // Derive the metric from the resulting state (set by the transition above) rather than from
439 // each branch, mirroring how the completion handler emits from the post-transition state.
440 > finalOp, err := hsm.MachineData[Operation](node) executors.go
441 > if err != nil {
442 return err
443 }
444 > emitMetrics = e.deferredOperationMetric(finalOp, callErr, node.NamespaceName(), node.WorkflowTypeName(), env.Now()) executors.go
445 > return nil
446 })
447 > if err != nil { executors.go
448 return err
449 }
450 > if emitMetrics != nil { executors.go
451 > emitMetrics() executors.go
452 > }
453 > return nil executors.go
454 }
455
490 // commits so the metric is not double-counted if the commit fails and the task is retried. callErr
491 // carries the timeout type for the below-min-request-timeout case.
492 > func (e taskExecutor) deferredOperationMetric(op Operation, callErr error, namespaceName, workflowType string, closeTime time.Time) func() { executors.go
493 > switch op.State() {
494 case enumsspb.NEXUS_OPERATION_STATE_SUCCEEDED:
495 return func() {
500 emitOperationCanceled(e.MetricsHandler, e.metricTagConfig(), op, namespaceName, workflowType, closeTime)
501 }
502 > case enumsspb.NEXUS_OPERATION_STATE_FAILED: executors.go
503 > return func() {
504 > emitOperationFailed(e.MetricsHandler, e.metricTagConfig(), op, namespaceName, workflowType, closeTime)
505 > }
506 case enumsspb.NEXUS_OPERATION_STATE_TIMED_OUT:
507 timeoutType := enumspb.TIMEOUT_TYPE_UNSPECIFIED
531 // attempt failure. It does not emit metrics; saveResult derives the caller-side metric from the
532 // resulting state (see deferredOperationMetric).
533 > func (e taskExecutor) handleStartOperationError(env hsm.Environment, node *hsm.Node, operation Operation, callErr error) error { executors.go
534 > var handlerErr *nexus.HandlerError
535 > var opErr *nexus.OperationError
536 > var opTimeoutBelowMinErr *operationTimeoutBelowMinError
537 > var serviceErr serviceerror.ServiceError
538 >
539 > switch {
540 case errors.As(callErr, &serviceErr):
541 if !common.IsRetryableRPCError(callErr) {
553 // operation if the response body is too large.
554 return handleNonRetryableStartOperationError(node, operation, callErr)
555 > case errors.Is(callErr, ErrInvalidOperationToken): executors.go
556 > // Following practices from workflow task completion payload size limit enforcement, we do not retry this
557 > // operation if the response's operation token is too large.
558 > return handleNonRetryableStartOperationError(node, operation, callErr)
559 case errors.As(callErr, &opTimeoutBelowMinErr):
560 // Not enough time to execute another request, resolve the operation with a timeout.
581 }
582
583 > func handleNonRetryableStartOperationError(node *hsm.Node, operation Operation, callErr error) error { executors.go
584 > eventID, err := hsm.EventIDFromToken(operation.ScheduledEventToken)
585 > if err != nil {
586 return err
587 }
588 > cause, err := callErrToFailure(callErr, false) executors.go
589 > if err != nil {
590 return err
591 }
592 > attrs := &historypb.NexusOperationFailedEventAttributes{ executors.go
593 > Failure: createNexusOperationFailure(
594 > operation,
595 > eventID,
596 > cause,
597 > ),
598 > ScheduledEventId: eventID,
599 > RequestId: operation.RequestId,
600 > }
601 > event := node.AddHistoryEvent(enumspb.EVENT_TYPE_NEXUS_OPERATION_FAILED, func(e *historypb.HistoryEvent) {
602 > // nolint:revive // We must mutate here even if the linter doesn't like it.
603 > e.Attributes = &historypb.HistoryEvent_NexusOperationFailedEventAttributes{
604 > NexusOperationFailedEventAttributes: attrs,
605 > }
606 > })
607
608 > return FailedEventDefinition{}.Apply(node.Parent, event) executors.go
609 }
610
935 // the system. We try to get the endpoint by name to support cases where an operator manually created an endpoint with
936 // the same name in two replicas.
937 > func (e taskExecutor) lookupEndpoint(ctx context.Context, namespaceID namespace.ID, endpointID, endpointName string) (*persistencespb.NexusEndpointEntry, error) { executors.go
938 > entry, err := e.EndpointRegistry.GetByID(ctx, endpointID)
939 > if err != nil {
940 if errors.As(err, new(*serviceerror.NotFound)) {
941 return e.EndpointRegistry.GetByName(ctx, namespaceID, endpointName)
943 return nil, err
944 }
945 > return entry, nil executors.go
946 }
947
948 > func createNexusOperationFailure(operation Operation, scheduledEventID int64, cause *failurepb.Failure) *failurepb.Failure { executors.go
949 > return &failurepb.Failure{
950 > Message: "nexus operation completed unsuccessfully",
951 > FailureInfo: &failurepb.Failure_NexusOperationExecutionFailureInfo{
952 > NexusOperationExecutionFailureInfo: &failurepb.NexusOperationFailureInfo{
953 > Endpoint: operation.Endpoint,
954 > Service: operation.Service,
955 > Operation: operation.Operation,
956 > OperationToken: operation.OperationToken,
957 > // TODO(bergundy): This field is deprecated, remove it after the 1.27 release.
958 > OperationId: operation.OperationToken,
959 > ScheduledEventId: scheduledEventID,
960 > },
961 > },
962 > Cause: cause,
963 > }
964 > }
965
966 > func startCallOutcomeTag(callCtx context.Context, result *nexusrpc.ClientStartOperationResponse[*commonpb.Payload], callErr error) string { executors.go
967 >
968 > if callErr != nil {
969 > var opTimeoutBelowMinErr *operationTimeoutBelowMinError executors.go
970 > if errors.As(callErr, &opTimeoutBelowMinErr) {
971 return "operation-timeout"
972 }
973 > if errors.Is(callErr, ErrInvalidOperationToken) { executors.go
974 > return "invalid-operation-token" executors.go
975 > }
976 if errors.Is(callErr, errOpProcessorFailed) {
977 return "operation-processor-failed"
1025 }
1026
1027 > func isDestinationDown(err error) bool { executors.go
1028 > var serviceErr serviceerror.ServiceError
1029 > // For the system endpoint, we don't even consider the destination down since it's internal.
1030 > if errors.As(err, &serviceErr) {
1031 return false
1032 }
1033 > var opFailedErr *nexus.OperationError executors.go
1034 > if errors.As(err, &opFailedErr) {
1035 return false
1036 }
1037 > var handlerError *nexus.HandlerError executors.go
1038 > if errors.As(err, &handlerError) {
1039 return handlerError.Retryable()
1040 }
1041 > if errors.Is(err, errOpProcessorFailed) { executors.go
1042 return false
1043 }
1044 > if errors.Is(err, ErrResponseBodyTooLarge) { executors.go
1045 return false
1046 }
1047 > if errors.Is(err, ErrInvalidOperationToken) { executors.go
1048 > return false executors.go
1049 > }
1050 var opTimeoutBelowMinErr *operationTimeoutBelowMinError
1051 return !errors.As(err, &opTimeoutBelowMinErr)
1052 }
1053
1054 > func callErrToFailure(callErr error, retryable bool) (*failurepb.Failure, error) { executors.go
1055 > var serviceErr serviceerror.ServiceError
1056 > if errors.As(callErr, &serviceErr) {
1057 return &failurepb.Failure{
1058 Message: fmt.Sprintf("%s: %s", strings.Replace(fmt.Sprintf("%T", serviceErr), "*serviceerror.", "", 1), serviceErr.Error()),
1064 }, nil
1065 }
1066 > var handlerErr *nexus.HandlerError executors.go
1067 > if errors.As(callErr, &handlerErr) {
1068 var nf nexus.Failure
1069 if handlerErr.OriginalFailure != nil {
1083 }
1084
1085 > return &failurepb.Failure{ executors.go
1086 > Message: callErr.Error(),
1087 > FailureInfo: &failurepb.Failure_ApplicationFailureInfo{
1088 > ApplicationFailureInfo: &failurepb.ApplicationFailureInfo{
1089 > Type: "CallError",
1090 > NonRetryable: !retryable,
1091 > },
1092 > },
1093 > }, nil
1094 }
1095
1096 > func failureSourceFromContext(ctx context.Context) string { executors.go
1097 > ctxVal := ctx.Value(commonnexus.FailureSourceContextKey)
1098 > if ctxVal == nil {
1099 return ""
1100 }
1101 > val, ok := ctxVal.(*atomic.Value) executors.go
1102 > if !ok {
1103 return ""
1104 }
1105 > src := val.Load() executors.go
1106 > if src == nil {
1107 > return ""
1108 > }
1109 source, ok := src.(string)
1110 if !ok {
1221 args startArgs,
1222 options nexus.StartOperationOptions,
1223 > ) (*nexusrpc.ClientStartOperationResponse[*commonpb.Payload], error) { executors.go
1224 > rawResult, callErr := client.StartOperation(ctx, args.operation, args.payload, options)
1225 >
1226 > var result *nexusrpc.ClientStartOperationResponse[*commonpb.Payload]
1227 > if callErr == nil {
1228 > if rawResult.Pending != nil { executors.go
1229 > result = &nexusrpc.ClientStartOperationResponse[*commonpb.Payload]{ executors.go
1230 > Pending: &nexusrpc.OperationHandle[*commonpb.Payload]{
1231 > Operation: rawResult.Pending.Operation,
1232 > Token: rawResult.Pending.Token,
1233 > },
1234 > Links: rawResult.Links,
1235 > }
1236 > } else { executors.go
1237 var payload *commonpb.Payload
1238 err := rawResult.Successful.Consume(&payload)
1247 }
1248 }
1249 > return result, callErr executors.go
1250 }
go.temporal.io/server/common/dynamicconfig/setting_gen.go 270 covered LOC · 61 ranges

Open complete file

26 type GlobalBoolConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[bool]
27
28 > func NewGlobalBoolSetting(key string, def bool, description string) GlobalBoolSetting { setting_gen.go
29 > return NewGlobalTypedSettingWithConverter[bool](key, convertBool, def, description)
30 > }
31
32 func NewGlobalBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) GlobalBoolConstrainedDefaultSetting {
36 type BoolPropertyFn = TypedPropertyFn[bool]
37
38 > func GetBoolPropertyFn(value bool) BoolPropertyFn { setting_gen.go
39 > return GetTypedPropertyFn(value)
40 > }
41
42 type NamespaceBoolSetting = NamespaceTypedSetting[bool]
43 type NamespaceBoolConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[bool]
44
45 > func NewNamespaceBoolSetting(key string, def bool, description string) NamespaceBoolSetting { setting_gen.go
46 > return NewNamespaceTypedSettingWithConverter[bool](key, convertBool, def, description)
47 > }
48
49 func NewNamespaceBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) NamespaceBoolConstrainedDefaultSetting {
53 type BoolPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[bool]
54
55 > func GetBoolPropertyFnFilteredByNamespace(value bool) BoolPropertyFnWithNamespaceFilter { setting_gen.go
56 > return GetTypedPropertyFnFilteredByNamespace(value)
57 > }
58
59 type NamespaceIDBoolSetting = NamespaceIDTypedSetting[bool]
60 type NamespaceIDBoolConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[bool]
61
62 > func NewNamespaceIDBoolSetting(key string, def bool, description string) NamespaceIDBoolSetting { setting_gen.go
63 > return NewNamespaceIDTypedSettingWithConverter[bool](key, convertBool, def, description)
64 > }
65
66 func NewNamespaceIDBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) NamespaceIDBoolConstrainedDefaultSetting {
77 type TaskQueueBoolConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[bool]
78
79 > func NewTaskQueueBoolSetting(key string, def bool, description string) TaskQueueBoolSetting { setting_gen.go
80 > return NewTaskQueueTypedSettingWithConverter[bool](key, convertBool, def, description)
81 > }
82
83 func NewTaskQueueBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) TaskQueueBoolConstrainedDefaultSetting {
128 type DestinationBoolConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[bool]
129
130 > func NewDestinationBoolSetting(key string, def bool, description string) DestinationBoolSetting { setting_gen.go
131 > return NewDestinationTypedSettingWithConverter[bool](key, convertBool, def, description)
132 > }
133
134 func NewDestinationBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) DestinationBoolConstrainedDefaultSetting {
162 type GlobalIntConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[int]
163
164 > func NewGlobalIntSetting(key string, def int, description string) GlobalIntSetting { setting_gen.go
165 > return NewGlobalTypedSettingWithConverter[int](key, convertInt, def, description)
166 > }
167
168 func NewGlobalIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) GlobalIntConstrainedDefaultSetting {
179 type NamespaceIntConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[int]
180
181 > func NewNamespaceIntSetting(key string, def int, description string) NamespaceIntSetting { setting_gen.go
182 > return NewNamespaceTypedSettingWithConverter[int](key, convertInt, def, description)
183 > }
184
185 func NewNamespaceIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) NamespaceIntConstrainedDefaultSetting {
189 type IntPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[int]
190
191 > func GetIntPropertyFnFilteredByNamespace(value int) IntPropertyFnWithNamespaceFilter { setting_gen.go
192 > return GetTypedPropertyFnFilteredByNamespace(value)
193 > }
194
195 type NamespaceIDIntSetting = NamespaceIDTypedSetting[int]
213 type TaskQueueIntConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[int]
214
215 > func NewTaskQueueIntSetting(key string, def int, description string) TaskQueueIntSetting { setting_gen.go
216 > return NewTaskQueueTypedSettingWithConverter[int](key, convertInt, def, description)
217 > }
218
219 > func NewTaskQueueIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) TaskQueueIntConstrainedDefaultSetting { setting_gen.go
220 > return NewTaskQueueTypedSettingWithConstrainedDefault[int](key, convertInt, cdef, description)
221 > }
222
223 type IntPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[int]
230 type ShardIDIntConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[int]
231
232 > func NewShardIDIntSetting(key string, def int, description string) ShardIDIntSetting { setting_gen.go
233 > return NewShardIDTypedSettingWithConverter[int](key, convertInt, def, description)
234 > }
235
236 func NewShardIDIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) ShardIDIntConstrainedDefaultSetting {
264 type DestinationIntConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[int]
265
266 > func NewDestinationIntSetting(key string, def int, description string) DestinationIntSetting { setting_gen.go
267 > return NewDestinationTypedSettingWithConverter[int](key, convertInt, def, description)
268 > }
269
270 func NewDestinationIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) DestinationIntConstrainedDefaultSetting {
298 type GlobalFloatConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[float64]
299
300 > func NewGlobalFloatSetting(key string, def float64, description string) GlobalFloatSetting { setting_gen.go
301 > return NewGlobalTypedSettingWithConverter[float64](key, convertFloat, def, description)
302 > }
303
304 func NewGlobalFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) GlobalFloatConstrainedDefaultSetting {
315 type NamespaceFloatConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[float64]
316
317 > func NewNamespaceFloatSetting(key string, def float64, description string) NamespaceFloatSetting { setting_gen.go
318 > return NewNamespaceTypedSettingWithConverter[float64](key, convertFloat, def, description)
319 > }
320
321 func NewNamespaceFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) NamespaceFloatConstrainedDefaultSetting {
349 type TaskQueueFloatConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[float64]
350
351 > func NewTaskQueueFloatSetting(key string, def float64, description string) TaskQueueFloatSetting { setting_gen.go
352 > return NewTaskQueueTypedSettingWithConverter[float64](key, convertFloat, def, description)
353 > }
354
355 func NewTaskQueueFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) TaskQueueFloatConstrainedDefaultSetting {
366 type ShardIDFloatConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[float64]
367
368 > func NewShardIDFloatSetting(key string, def float64, description string) ShardIDFloatSetting { setting_gen.go
369 > return NewShardIDTypedSettingWithConverter[float64](key, convertFloat, def, description)
370 > }
371
372 func NewShardIDFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) ShardIDFloatConstrainedDefaultSetting {
400 type DestinationFloatConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[float64]
401
402 > func NewDestinationFloatSetting(key string, def float64, description string) DestinationFloatSetting { setting_gen.go
403 > return NewDestinationTypedSettingWithConverter[float64](key, convertFloat, def, description)
404 > }
405
406 func NewDestinationFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) DestinationFloatConstrainedDefaultSetting {
434 type GlobalStringConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[string]
435
436 > func NewGlobalStringSetting(key string, def string, description string) GlobalStringSetting { setting_gen.go
437 > return NewGlobalTypedSettingWithConverter[string](key, convertString, def, description)
438 > }
439
440 func NewGlobalStringSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[string], description string) GlobalStringConstrainedDefaultSetting {
444 type StringPropertyFn = TypedPropertyFn[string]
445
446 > func GetStringPropertyFn(value string) StringPropertyFn { setting_gen.go
447 > return GetTypedPropertyFn(value)
448 > }
449
450 type NamespaceStringSetting = NamespaceTypedSetting[string]
570 type GlobalDurationConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[time.Duration]
571
572 > func NewGlobalDurationSetting(key string, def time.Duration, description string) GlobalDurationSetting { setting_gen.go
573 > return NewGlobalTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
574 > }
575
576 func NewGlobalDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) GlobalDurationConstrainedDefaultSetting {
587 type NamespaceDurationConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[time.Duration]
588
589 > func NewNamespaceDurationSetting(key string, def time.Duration, description string) NamespaceDurationSetting { setting_gen.go
590 > return NewNamespaceTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
591 > }
592
593 func NewNamespaceDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) NamespaceDurationConstrainedDefaultSetting {
597 type DurationPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[time.Duration]
598
599 > func GetDurationPropertyFnFilteredByNamespace(value time.Duration) DurationPropertyFnWithNamespaceFilter { setting_gen.go
600 > return GetTypedPropertyFnFilteredByNamespace(value)
601 > }
602
603 type NamespaceIDDurationSetting = NamespaceIDTypedSetting[time.Duration]
604 type NamespaceIDDurationConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[time.Duration]
605
606 > func NewNamespaceIDDurationSetting(key string, def time.Duration, description string) NamespaceIDDurationSetting { setting_gen.go
607 > return NewNamespaceIDTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
608 > }
609
610 func NewNamespaceIDDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) NamespaceIDDurationConstrainedDefaultSetting {
621 type TaskQueueDurationConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[time.Duration]
622
623 > func NewTaskQueueDurationSetting(key string, def time.Duration, description string) TaskQueueDurationSetting { setting_gen.go
624 > return NewTaskQueueTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
625 > }
626
627 > func NewTaskQueueDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) TaskQueueDurationConstrainedDefaultSetting { setting_gen.go
628 > return NewTaskQueueTypedSettingWithConstrainedDefault[time.Duration](key, convertDuration, cdef, description)
629 > }
630
631 type DurationPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[time.Duration]
638 type ShardIDDurationConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[time.Duration]
639
640 > func NewShardIDDurationSetting(key string, def time.Duration, description string) ShardIDDurationSetting { setting_gen.go
641 > return NewShardIDTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
642 > }
643
644 func NewShardIDDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) ShardIDDurationConstrainedDefaultSetting {
655 type TaskTypeDurationConstrainedDefaultSetting = TaskTypeTypedConstrainedDefaultSetting[time.Duration]
656
657 > func NewTaskTypeDurationSetting(key string, def time.Duration, description string) TaskTypeDurationSetting { setting_gen.go
658 > return NewTaskTypeTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
659 > }
660
661 func NewTaskTypeDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) TaskTypeDurationConstrainedDefaultSetting {
672 type DestinationDurationConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[time.Duration]
673
674 > func NewDestinationDurationSetting(key string, def time.Duration, description string) DestinationDurationSetting { setting_gen.go
675 > return NewDestinationTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
676 > }
677
678 func NewDestinationDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) DestinationDurationConstrainedDefaultSetting {
682 type DurationPropertyFnWithDestinationFilter = TypedPropertyFnWithDestinationFilter[time.Duration]
683
684 > func GetDurationPropertyFnFilteredByDestination(value time.Duration) DurationPropertyFnWithDestinationFilter { setting_gen.go
685 > return GetTypedPropertyFnFilteredByDestination(value)
686 > }
687
688 type ChasmTaskTypeDurationSetting = ChasmTaskTypeTypedSetting[time.Duration]
689 type ChasmTaskTypeDurationConstrainedDefaultSetting = ChasmTaskTypeTypedConstrainedDefaultSetting[time.Duration]
690
691 > func NewChasmTaskTypeDurationSetting(key string, def time.Duration, description string) ChasmTaskTypeDurationSetting { setting_gen.go
692 > return NewChasmTaskTypeTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
693 > }
694
695 func NewChasmTaskTypeDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) ChasmTaskTypeDurationConstrainedDefaultSetting {
723 type NamespaceMapConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[map[string]any]
724
725 > func NewNamespaceMapSetting(key string, def map[string]any, description string) NamespaceMapSetting { setting_gen.go
726 > return NewNamespaceTypedSettingWithConverter[map[string]any](key, convertMap, def, description)
727 > }
728
729 func NewNamespaceMapSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[map[string]any], description string) NamespaceMapConstrainedDefaultSetting {
845 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
846 // when using non-empty maps or slices as defaults, the result may not be what you want.
847 > func NewGlobalTypedSetting[T any](key string, def T, description string) GlobalTypedSetting[T] { setting_gen.go
848 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
849 > warnDefaultSharedStructure(key, def)
850 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
851 > _ = deepCopyForMapstructure(def)
852 >
853 > s := GlobalTypedSetting[T]{
854 > key: MakeKey(key),
855 > def: def,
856 > convert: ConvertStructure[T](def),
857 > description: description,
858 > }
859 > register(s)
860 > return s
861 > }
862
863 // NewGlobalTypedSettingWithConverter creates a setting with a custom converter function.
864 > func NewGlobalTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) GlobalTypedSetting[T] { setting_gen.go
865 > s := GlobalTypedSetting[T]{
866 > key: MakeKey(key),
867 > def: def,
868 > convert: convert,
869 > description: description,
870 > }
871 > register(s)
872 > return s
873 > }
874
875 // NewGlobalTypedSettingWithConstrainedDefault creates a setting with a compound default value.
885 }
886
887 > func (s GlobalTypedSetting[T]) Key() Key { return s.key } setting_gen.go
888 func (s GlobalTypedSetting[T]) Precedence() Precedence { return PrecedenceGlobal }
889 func (s GlobalTypedSetting[T]) Validate(v any) error {
969 }
970
971 > func GetTypedPropertyFn[T any](value T) TypedPropertyFn[T] { setting_gen.go
972 > return func() T {
973 > return value setting_gen.go
974 > }
975 }
976
981 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
982 // when using non-empty maps or slices as defaults, the result may not be what you want.
983 > func NewNamespaceTypedSetting[T any](key string, def T, description string) NamespaceTypedSetting[T] { setting_gen.go
984 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
985 > warnDefaultSharedStructure(key, def)
986 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
987 > _ = deepCopyForMapstructure(def)
988 >
989 > s := NamespaceTypedSetting[T]{
990 > key: MakeKey(key),
991 > def: def,
992 > convert: ConvertStructure[T](def),
993 > description: description,
994 > }
995 > register(s)
996 > return s
997 > }
998
999 // NewNamespaceTypedSettingWithConverter creates a setting with a custom converter function.
1000 > func NewNamespaceTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) NamespaceTypedSetting[T] { setting_gen.go
1001 > s := NamespaceTypedSetting[T]{
1002 > key: MakeKey(key),
1003 > def: def,
1004 > convert: convert,
1005 > description: description,
1006 > }
1007 > register(s)
1008 > return s
1009 > }
1010
1011 // NewNamespaceTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1021 }
1022
1023 > func (s NamespaceTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1024 func (s NamespaceTypedSetting[T]) Precedence() Precedence { return PrecedenceNamespace }
1025 func (s NamespaceTypedSetting[T]) Validate(v any) error {
1105 }
1106
1107 > func GetTypedPropertyFnFilteredByNamespace[T any](value T) TypedPropertyFnWithNamespaceFilter[T] { setting_gen.go
1108 > return func(namespace string) T {
1109 > return value setting_gen.go
1110 > }
1111 }
1112
1134
1135 // NewNamespaceIDTypedSettingWithConverter creates a setting with a custom converter function.
1136 > func NewNamespaceIDTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) NamespaceIDTypedSetting[T] { setting_gen.go
1137 > s := NamespaceIDTypedSetting[T]{
1138 > key: MakeKey(key),
1139 > def: def,
1140 > convert: convert,
1141 > description: description,
1142 > }
1143 > register(s)
1144 > return s
1145 > }
1146
1147 // NewNamespaceIDTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1157 }
1158
1159 > func (s NamespaceIDTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1160 func (s NamespaceIDTypedSetting[T]) Precedence() Precedence { return PrecedenceNamespaceID }
1161 func (s NamespaceIDTypedSetting[T]) Validate(v any) error {
1253 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
1254 // when using non-empty maps or slices as defaults, the result may not be what you want.
1255 > func NewTaskQueueTypedSetting[T any](key string, def T, description string) TaskQueueTypedSetting[T] { setting_gen.go
1256 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
1257 > warnDefaultSharedStructure(key, def)
1258 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
1259 > _ = deepCopyForMapstructure(def)
1260 >
1261 > s := TaskQueueTypedSetting[T]{
1262 > key: MakeKey(key),
1263 > def: def,
1264 > convert: ConvertStructure[T](def),
1265 > description: description,
1266 > }
1267 > register(s)
1268 > return s
1269 > }
1270
1271 // NewTaskQueueTypedSettingWithConverter creates a setting with a custom converter function.
1272 > func NewTaskQueueTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) TaskQueueTypedSetting[T] { setting_gen.go
1273 > s := TaskQueueTypedSetting[T]{
1274 > key: MakeKey(key),
1275 > def: def,
1276 > convert: convert,
1277 > description: description,
1278 > }
1279 > register(s)
1280 > return s
1281 > }
1282
1283 // NewTaskQueueTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1284 > func NewTaskQueueTypedSettingWithConstrainedDefault[T any](key string, convert func(any) (T, error), cdef []TypedConstrainedValue[T], description string) TaskQueueTypedConstrainedDefaultSetting[T] { setting_gen.go
1285 > s := TaskQueueTypedConstrainedDefaultSetting[T]{
1286 > key: MakeKey(key),
1287 > cdef: cdef,
1288 > convert: convert,
1289 > description: description,
1290 > }
1291 > register(s)
1292 > return s
1293 > }
1294
1295 > func (s TaskQueueTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1296 func (s TaskQueueTypedSetting[T]) Precedence() Precedence { return PrecedenceTaskQueue }
1297 func (s TaskQueueTypedSetting[T]) Validate(v any) error {
1300 }
1301
1302 > func (s TaskQueueTypedConstrainedDefaultSetting[T]) Key() Key { return s.key } setting_gen.go
1303 func (s TaskQueueTypedConstrainedDefaultSetting[T]) Precedence() Precedence { return PrecedenceTaskQueue }
1304 func (s TaskQueueTypedConstrainedDefaultSetting[T]) Validate(v any) error {
1430
1431 // NewShardIDTypedSettingWithConverter creates a setting with a custom converter function.
1432 > func NewShardIDTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) ShardIDTypedSetting[T] { setting_gen.go
1433 > s := ShardIDTypedSetting[T]{
1434 > key: MakeKey(key),
1435 > def: def,
1436 > convert: convert,
1437 > description: description,
1438 > }
1439 > register(s)
1440 > return s
1441 > }
1442
1443 // NewShardIDTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1453 }
1454
1455 > func (s ShardIDTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1456 func (s ShardIDTypedSetting[T]) Precedence() Precedence { return PrecedenceShardID }
1457 func (s ShardIDTypedSetting[T]) Validate(v any) error {
1566
1567 // NewTaskTypeTypedSettingWithConverter creates a setting with a custom converter function.
1568 > func NewTaskTypeTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) TaskTypeTypedSetting[T] { setting_gen.go
1569 > s := TaskTypeTypedSetting[T]{
1570 > key: MakeKey(key),
1571 > def: def,
1572 > convert: convert,
1573 > description: description,
1574 > }
1575 > register(s)
1576 > return s
1577 > }
1578
1579 // NewTaskTypeTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1589 }
1590
1591 > func (s TaskTypeTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1592 func (s TaskTypeTypedSetting[T]) Precedence() Precedence { return PrecedenceTaskType }
1593 func (s TaskTypeTypedSetting[T]) Validate(v any) error {
1685 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
1686 // when using non-empty maps or slices as defaults, the result may not be what you want.
1687 > func NewDestinationTypedSetting[T any](key string, def T, description string) DestinationTypedSetting[T] { setting_gen.go
1688 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
1689 > warnDefaultSharedStructure(key, def)
1690 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
1691 > _ = deepCopyForMapstructure(def)
1692 >
1693 > s := DestinationTypedSetting[T]{
1694 > key: MakeKey(key),
1695 > def: def,
1696 > convert: ConvertStructure[T](def),
1697 > description: description,
1698 > }
1699 > register(s)
1700 > return s
1701 > }
1702
1703 // NewDestinationTypedSettingWithConverter creates a setting with a custom converter function.
1704 > func NewDestinationTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) DestinationTypedSetting[T] { setting_gen.go
1705 > s := DestinationTypedSetting[T]{
1706 > key: MakeKey(key),
1707 > def: def,
1708 > convert: convert,
1709 > description: description,
1710 > }
1711 > register(s)
1712 > return s
1713 > }
1714
1715 // NewDestinationTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1725 }
1726
1727 > func (s DestinationTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1728 func (s DestinationTypedSetting[T]) Precedence() Precedence { return PrecedenceDestination }
1729 func (s DestinationTypedSetting[T]) Validate(v any) error {
1829 }
1830
1831 > func GetTypedPropertyFnFilteredByDestination[T any](value T) TypedPropertyFnWithDestinationFilter[T] { setting_gen.go
1832 > return func(namespace string, destination string) T {
1833 > return value setting_gen.go
1834 > }
1835 }
1836
1858
1859 // NewChasmTaskTypeTypedSettingWithConverter creates a setting with a custom converter function.
1860 > func NewChasmTaskTypeTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) ChasmTaskTypeTypedSetting[T] { setting_gen.go
1861 > s := ChasmTaskTypeTypedSetting[T]{
1862 > key: MakeKey(key),
1863 > def: def,
1864 > convert: convert,
1865 > description: description,
1866 > }
1867 > register(s)
1868 > return s
1869 > }
1870
1871 // NewChasmTaskTypeTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1881 }
1882
1883 > func (s ChasmTaskTypeTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1884 func (s ChasmTaskTypeTypedSetting[T]) Precedence() Precedence { return PrecedenceChasmTaskType }
1885 func (s ChasmTaskTypeTypedSetting[T]) Validate(v any) error {
go.temporal.io/server/service/history/hsm/tree.go 184 covered LOC · 47 ranges

Open complete file

171
172 // EventIDFromToken gets the event ID associated with an event load token.
173 > func EventIDFromToken(token []byte) (int64, error) { tree.go
174 > ref := &tokenspb.HistoryEventRef{}
175 > err := proto.Unmarshal(token, ref)
176 > return ref.EventId, err
177 > }
178
179 // Node is a node in a hierarchical state machine tree.
204 children map[string]*persistencespb.StateMachineMap,
205 backend NodeBackend,
206 > ) (*Node, error) { tree.go
207 > def, ok := registry.Machine(t)
208 > if !ok {
209 return nil, fmt.Errorf("%w: state machine for type: %v", ErrNotRegistered, t)
210 }
211 > serialized, err := def.Serialize(data) tree.go
212 > if err != nil {
213 return nil, err
214 }
215 > return &Node{ tree.go
216 > definition: def,
217 > registry: registry,
218 > persistence: &persistencespb.StateMachineNode{
219 > Children: children,
220 > Data: serialized,
221 > InitialVersionedTransition: &persistencespb.VersionedTransition{},
222 > LastUpdateVersionedTransition: &persistencespb.VersionedTransition{},
223 > TransitionCount: 0,
224 > },
225 > cache: &cachedMachine{
226 > dataLoaded: true,
227 > data: data,
228 > children: make(map[Key]*Node),
229 > },
230 > backend: backend,
231 > opLog: make(OperationLog, 0),
232 > }, nil
233 }
234
251 }
252
253 > func (n *Node) Path() []Key { tree.go
254 > if n.Parent == nil {
255 > return []Key{}
256 > }
257 > return append(n.Parent.Path(), n.Key) tree.go
258 }
259
285 // Walk applies the given function to all nodes rooted at the current node.
286 // Returns after successfully applying the function to all nodes or first error.
287 > func (n *Node) Walk(fn func(*Node) error) error { tree.go
288 > if n == nil {
289 return nil
290 }
291
292 > if err := fn(n); err != nil { tree.go
293 return err
294 }
295
296 > for childType := range n.persistence.Children { tree.go
297 childNodes := NewCollection[any](n, childType).List()
298 for _, child := range childNodes {
303 }
304
305 > return nil tree.go
306 }
307
308 // Child recursively gets a child for the given path.
309 > func (n *Node) Child(path []Key) (*Node, error) { tree.go
310 > if len(path) == 0 {
311 > return n, nil tree.go
312 > }
313 > key, rest := path[0], path[1:] tree.go
314 > if child, ok := n.cache.children[key]; ok {
315 > return child.Child(rest) tree.go
316 > }
317 def, ok := n.registry.Machine(key.Type)
318 if !ok {
349 // Returns [ErrStateMachineAlreadyExists] if a child with the given key already exists, [ErrNotRegistered] if the key's
350 // type is not found in the node's state machine registry and serialization errors.
351 > func (n *Node) AddChild(key Key, data any) (*Node, error) { tree.go
352 > machines, ok := n.persistence.Children[key.Type]
353 > if ok {
354 if _, ok = machines.MachinesById[key.ID]; ok {
355 if ok {
358 }
359 }
360 > def, ok := n.registry.Machine(key.Type) tree.go
361 > if !ok {
362 return nil, fmt.Errorf("%w: state machine for type: %v", ErrNotRegistered, key.Type)
363 }
364 > serialized, err := def.Serialize(data) tree.go
365 > if err != nil {
366 return nil, err
367 }
368
369 > nextVersionedTransition := &persistencespb.VersionedTransition{ tree.go
370 > NamespaceFailoverVersion: n.backend.GetCurrentVersion(),
371 > // The transition count for the backend is only incremented when closing the current transaction,
372 > // but any change to state machine node is a state transtion,
373 > // so we can safely using next transition count here is safe.
374 > TransitionCount: n.backend.NextTransitionCount(),
375 > }
376 > node := &Node{
377 > Key: key,
378 > Parent: n,
379 > definition: def,
380 > registry: n.registry,
381 > persistence: &persistencespb.StateMachineNode{
382 > Children: make(map[string]*persistencespb.StateMachineMap),
383 > Data: serialized,
384 > InitialVersionedTransition: nextVersionedTransition,
385 > LastUpdateVersionedTransition: nextVersionedTransition,
386 > TransitionCount: 0,
387 > },
388 > cache: &cachedMachine{
389 > dataLoaded: true,
390 > data: data,
391 > dirty: true,
392 > children: make(map[Key]*Node),
393 > },
394 > backend: n.backend,
395 > }
396 > n.cache.children[key] = node
397 > children, ok := n.persistence.Children[key.Type]
398 > if !ok {
399 > children = &persistencespb.StateMachineMap{MachinesById: make(map[string]*persistencespb.StateMachineNode)} tree.go
400 > // Children may be nil if the map was empty and the proto message we serialized and deserialized.
401 > if n.persistence.Children == nil {
402 n.persistence.Children = make(map[string]*persistencespb.StateMachineMap, 1)
403 }
404 > n.persistence.Children[key.Type] = children tree.go
405 }
406 > children.MachinesById[key.ID] = node.persistence tree.go
407 > return node, nil
408 }
409
410 // DeleteChild marks a child node and all its descendants as deleted, removing them from the cache. No transitions will
411 // be allowed after deleting a child.
412 > func (n *Node) DeleteChild(key Key) error { tree.go
413 > if n.cache.deleted {
414 return fmt.Errorf("%w: cannot delete from deleted node: %v", ErrStateMachineInvalidState, n.Key)
415 }
416
417 > child, err := n.Child([]Key{key}) tree.go
418 > if err != nil {
419 return err
420 }
421
422 // Mark entire subtree as deleted
423 > if err := child.Walk(func(n *Node) error { tree.go
424 > n.cache.deleted = true
425 > return nil
426 > }); err != nil {
427 return err
428 }
429
430 > root := n.root() tree.go
431 > root.opLog = append(root.opLog, DeleteOperation{
432 > path: child.Path(),
433 > })
434 >
435 > // Remove from persistence and cache
436 > machinesMap := n.persistence.Children[key.Type]
437 > if machinesMap != nil {
438 > delete(machinesMap.MachinesById, key.ID)
439 > if len(machinesMap.MachinesById) == 0 {
440 > delete(n.persistence.Children, key.Type) tree.go
441 > }
442 }
443 > delete(n.cache.children, key) tree.go
444 > return nil
445 }
446
447 // AddHistoryEvent adds a history event to be committed at the end of the current transaction.
448 // Must be called within an [Environment.Access] function block with write access.
449 > func (n *Node) AddHistoryEvent(t enumspb.EventType, setAttributes func(*historypb.HistoryEvent)) *historypb.HistoryEvent { tree.go
450 > return n.backend.AddHistoryEvent(t, setAttributes)
451 > }
452
453 // GenerateEventLoadToken generates a token for loading the given history event via [LoadHistoryEvent].
454 // Must be called within an [Environment.Access] function block for an event that was just added or is currently
455 // being applied in the active transaction.
456 > func (n *Node) GenerateEventLoadToken(event *historypb.HistoryEvent) ([]byte, error) { tree.go
457 > return n.backend.GenerateEventLoadToken(event)
458 > }
459
460 // Load a history event by token generated via [GenerateEventLoadToken].
461 // Must be called within an [Environment.Access] function block with either read or write access.
462 > func (n *Node) LoadHistoryEvent(ctx context.Context, token []byte) (*historypb.HistoryEvent, error) { tree.go
463 > return n.backend.LoadHistoryEvent(ctx, token)
464 > }
465
466 // MachineData deserializes the persistent state machine's data, casts it to type T, and returns it.
467 // Returns an error when deserialization or casting fails.
468 > func MachineData[T any](n *Node) (T, error) { tree.go
469 > var t T
470 > if n.cache.dataLoaded {
471 > if t, ok := n.cache.data.(T); ok { tree.go
472 > return t, nil
473 > }
474 return t, ErrIncompatibleType
475 }
583 // It updates the state machine's metadata and marks the entry as dirty in the node's cache.
584 // If the transition fails, the changes are rolled back and no state is mutated.
585 > func MachineTransition[T any](n *Node, transitionFn func(T) (TransitionOutput, error)) (retErr error) { tree.go
586 > if n.cache.deleted {
587 return fmt.Errorf("%w: cannot transition deleted node: %v", ErrStateMachineInvalidState, n.Key)
588 }
589
590 > data, err := MachineData[T](n) tree.go
591 > if err != nil {
592 return err
593 }
594 // Update the transition counts before applying the transition function in case the transition function needs to
595 // generate references to this node.
596 > n.persistence.TransitionCount++ tree.go
597 > prevLastUpdatedVersionedTransition := n.persistence.LastUpdateVersionedTransition
598 > n.persistence.LastUpdateVersionedTransition = &persistencespb.VersionedTransition{
599 > NamespaceFailoverVersion: n.backend.GetCurrentVersion(),
600 > // The transition count for the backend is only incremented when closing the current transaction,
601 > // but any change to state machine node is a state transtion,
602 > // so we can safely using next transition count here.
603 > TransitionCount: n.backend.NextTransitionCount(),
604 > }
605 > // Rollback on error
606 > defer func() {
607 > if retErr != nil {
608 n.persistence.TransitionCount--
609 n.persistence.LastUpdateVersionedTransition = prevLastUpdatedVersionedTransition
612 }
613 }()
614 > output, err := transitionFn(data) tree.go
615 > if err != nil {
616 return err
617 }
618 > serialized, err := n.definition.Serialize(data) tree.go
619 > if err != nil {
620 return err
621 }
622 > n.persistence.Data = serialized tree.go
623 > n.cache.dirty = true
624 >
625 > root := n.root()
626 > root.opLog = append(root.opLog, TransitionOperation{
627 > path: n.Path(),
628 > Output: TransitionOutputWithCount{
629 > TransitionOutput: output,
630 > TransitionCount: n.persistence.TransitionCount,
631 > },
632 > })
633 >
634 > return nil
635 }
636
643
644 // NewCollection creates a new [Collection].
645 > func NewCollection[T any](node *Node, stateMachineType string) Collection[T] { tree.go
646 > return Collection[T]{
647 > Type: stateMachineType,
648 > node: node,
649 > }
650 > }
651
652 // Node gets an [Node] for a given state machine ID.
653 > func (c Collection[T]) Node(stateMachineID string) (*Node, error) { tree.go
654 > return c.node.Child([]Key{{Type: c.Type, ID: stateMachineID}})
655 > }
656
657 // List returns all nodes in this collection.
687
688 // Data gets the data for a given state machine ID.
689 > func (c Collection[T]) Data(stateMachineID string) (T, error) { tree.go
690 > node, err := c.Node(stateMachineID)
691 > if err != nil {
692 var zero T
693 return zero, err
694 }
695 > return MachineData[T](node) tree.go
696 }
697
705 }
706
707 > func (n *Node) root() *Node { tree.go
708 > root := n
709 > for root.Parent != nil {
710 > root = root.Parent tree.go
711 > }
712 > return root tree.go
713 }
714
715 // WorkflowTypeName returns the type name of the workflow that owns this node's state machine tree.
716 > func (n *Node) WorkflowTypeName() string { tree.go
717 > return n.root().backend.GetWorkflowType().GetName()
718 > }
719
720 // NamespaceName returns the name of the namespace that owns this node's state machine tree.
721 > func (n *Node) NamespaceName() string { tree.go
722 > return n.root().backend.GetNamespaceEntry().Name().String()
723 > }
724
725 // compact filters the operation log based on deletion status. For any operation path:
go.temporal.io/server/common/nexus/nexusrpc/api.go 122 covered LOC · 60 ranges

Open complete file

43 const statusOperationUnsuccessful = http.StatusFailedDependency
44
45 > func isMediaTypeJSON(contentType string) bool { api.go
46 > if contentType == "" {
47 return false
48 }
49 > mediaType, _, err := mime.ParseMediaType(contentType) api.go
50 > return err == nil && mediaType == "application/json"
51 }
52
53 > func prefixStrippedHTTPHeaderToNexusHeader(httpHeader http.Header, prefix string) nexus.Header { api.go
54 > header := nexus.Header{}
55 > for k, v := range httpHeader {
56 > lowerK := strings.ToLower(k)
57 > if strings.HasPrefix(lowerK, prefix) {
58 > // Nexus headers can only have single values, ignore multiple values. api.go
59 > header[lowerK[len(prefix):]] = v[0]
60 > }
61 }
62 > return header api.go
63 }
64
65 > func addContentHeaderToHTTPHeader(nexusHeader nexus.Header, httpHeader http.Header) http.Header { api.go
66 > for k, v := range nexusHeader {
67 > httpHeader.Set("Content-"+k, v) api.go
68 > }
69 > return httpHeader api.go
70 }
71
72 > func addCallbackHeaderToHTTPHeader(nexusHeader nexus.Header, httpHeader http.Header) http.Header { api.go
73 > for k, v := range nexusHeader {
74 > httpHeader.Set("Nexus-Callback-"+k, v) api.go
75 > }
76 > return httpHeader api.go
77 }
78
79 > func addLinksToHTTPHeader(links []nexus.Link, httpHeader http.Header) error { api.go
80 > for _, link := range links {
81 > encodedLink, err := encodeLink(link) api.go
82 > if err != nil {
83 return err
84 }
85 > httpHeader.Add(headerLink, encodedLink) api.go
86 }
87 > return nil api.go
88 }
89
90 > func getLinksFromHeader(httpHeader http.Header) ([]nexus.Link, error) { api.go
91 > var links []nexus.Link
92 > headerValues := httpHeader.Values(headerLink)
93 > if len(headerValues) == 0 {
94 > return nil, nil api.go
95 > }
96 > for encodedLink := range strings.SplitSeq(strings.Join(headerValues, ","), ",") { api.go
97 > link, err := decodeLink(encodedLink)
98 > if err != nil {
99 return nil, err
100 }
101 > links = append(links, link) api.go
102 }
103 > return links, nil api.go
104 }
105
106 > func httpHeaderToNexusHeader(httpHeader http.Header, excludePrefixes ...string) nexus.Header { api.go
107 > header := nexus.Header{}
108 > headerLoop:
109 > for k, v := range httpHeader {
110 > lowerK := strings.ToLower(k)
111 > for _, prefix := range excludePrefixes {
112 > if strings.HasPrefix(lowerK, prefix) { api.go
113 > continue headerLoop api.go
114 }
115 }
116 // Nexus headers can only have single values, ignore multiple values.
117 > header[lowerK] = v[0] api.go
118 }
119 > return header api.go
120 }
121
122 > func addNexusHeaderToHTTPHeader(nexusHeader nexus.Header, httpHeader http.Header) http.Header { api.go
123 > for k, v := range nexusHeader {
124 > httpHeader.Set(k, v) api.go
125 > }
126 > return httpHeader api.go
127 }
128
129 > func addContextTimeoutToHTTPHeader(ctx context.Context, httpHeader http.Header) http.Header { api.go
130 > deadline, ok := ctx.Deadline()
131 > if !ok {
132 return httpHeader
133 }
134 > httpHeader.Set(nexus.HeaderRequestTimeout, FormatDuration(time.Until(deadline))) api.go
135 > return httpHeader
136 }
137
140 // decodeLink encodes the link to Nexus-Link header value.
141 // It follows the same format of HTTP Link header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
142 > func encodeLink(link nexus.Link) (string, error) { api.go
143 > if err := validateLinkURL(link.URL); err != nil {
144 return "", fmt.Errorf("failed to encode link: %w", err)
145 }
146 > if err := validateLinkType(link.Type); err != nil { api.go
147 return "", fmt.Errorf("failed to encode link: %w", err)
148 }
149 > return fmt.Sprintf(`<%s>; %s="%s"`, link.URL.String(), linkTypeKey, link.Type), nil api.go
150 }
151
152 // decodeLink decodes the Nexus-Link header values.
153 // It must have the same format of HTTP Link header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
154 > func decodeLink(encodedLink string) (nexus.Link, error) { api.go
155 > var link nexus.Link
156 > encodedLink = strings.TrimSpace(encodedLink)
157 > if len(encodedLink) == 0 {
158 return link, errors.New("failed to parse link header: value is empty")
159 }
160
161 > if encodedLink[0] != '<' { api.go
162 return link, fmt.Errorf("failed to parse link header: invalid format: %s", encodedLink)
163 }
164 > urlEnd := strings.Index(encodedLink, ">") api.go
165 > if urlEnd == -1 {
166 return link, fmt.Errorf("failed to parse link header: invalid format: %s", encodedLink)
167 }
168 > urlStr := strings.TrimSpace(encodedLink[1:urlEnd]) api.go
169 > if len(urlStr) == 0 {
170 return link, errors.New("failed to parse link header: url is empty")
171 }
172 > u, err := url.Parse(urlStr) api.go
173 > if err != nil {
174 return link, fmt.Errorf("failed to parse link header: invalid url: %s", urlStr)
175 }
176 > if err := validateLinkURL(u); err != nil { api.go
177 return link, fmt.Errorf("failed to parse link header: %w", err)
178 }
179 > link.URL = u api.go
180 >
181 > params := strings.Split(encodedLink[urlEnd+1:], ";")
182 > // must contain at least one semi-colon, and first param must be empty since
183 > // it corresponds to the url part parsed above.
184 > if len(params) < 2 {
185 return link, fmt.Errorf("failed to parse link header: invalid format: %s", encodedLink)
186 }
187 > if strings.TrimSpace(params[0]) != "" { api.go
188 return link, fmt.Errorf("failed to parse link header: invalid format: %s", encodedLink)
189 }
190
191 > typeKeyFound := false api.go
192 > for _, param := range params[1:] {
193 > param = strings.TrimSpace(param)
194 > if len(param) == 0 {
195 return link, fmt.Errorf("failed to parse link header: parameter is empty: %s", encodedLink)
196 }
197 > kv := strings.SplitN(param, "=", 2) api.go
198 > if len(kv) != 2 {
199 return link, fmt.Errorf("failed to parse link header: invalid parameter format: %s", param)
200 }
201 > key := strings.TrimSpace(kv[0]) api.go
202 > val := strings.TrimSpace(kv[1])
203 > if strings.HasPrefix(val, `"`) != strings.HasSuffix(val, `"`) {
204 return link, fmt.Errorf(
205 "failed to parse link header: parameter value missing double-quote: %s",
207 )
208 }
209 > if strings.HasPrefix(val, `"`) { api.go
210 > val = val[1 : len(val)-1] api.go
211 > }
212 > if key == linkTypeKey { api.go
213 > if err := validateLinkType(val); err != nil {
214 return link, fmt.Errorf("failed to parse link header: %w", err)
215 }
216 > link.Type = val api.go
217 > typeKeyFound = true
218 }
219 }
220 > if !typeKeyFound { api.go
221 return link, fmt.Errorf(
222 "failed to parse link header: %q key not found: %s",
226 }
227
228 > return link, nil api.go
229 }
230
231 > func validateLinkURL(value *url.URL) error { api.go
232 > if value == nil || value.String() == "" {
233 return errors.New("url is empty")
234 }
235 > _, err := url.ParseQuery(value.RawQuery) api.go
236 > if err != nil {
237 return fmt.Errorf("url query not percent-encoded: %s", value)
238 }
239 > return nil api.go
240 }
241
242 > func validateLinkType(value string) error { api.go
243 > if len(value) == 0 {
244 return errors.New("link type is empty")
245 }
246 > for _, c := range value { api.go
247 > if (c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c < '0' || c > '9') && c != '_' && c != '.' && c != '/' {
248 return errors.New("link type contains invalid char (valid chars: alphanumeric, '_', '.', '/')")
249 }
250 }
251 > return nil api.go
252 }
253
254 var durationRegexp = regexp.MustCompile(`^(\d+(?:\.\d+)?)(ms|s|m)$`)
255
256 > func ParseDuration(value string) (time.Duration, error) { api.go
257 > m := durationRegexp.FindStringSubmatch(value)
258 > if len(m) == 0 {
259 return 0, fmt.Errorf("invalid duration: %q", value)
260 }
261 > v, err := strconv.ParseFloat(m[1], 64) api.go
262 > if err != nil {
263 return 0, err
264 }
265
266 > switch m[2] { api.go
267 > case "ms":
268 > return time.Millisecond * time.Duration(v), nil
269 case "s":
270 return time.Millisecond * time.Duration(v*1e3), nil
277
278 // FormatDuration converts a duration into a string representation in millisecond resolution.
279 > func FormatDuration(d time.Duration) string { api.go
280 > return strconv.FormatInt(d.Milliseconds(), 10) + "ms"
281 > }
282
283 // MarkAsWrapperError adds the "unwrap-error" metadata to the original failure of the given OperationError, which
go.temporal.io/server/common/nexus/nexusrpc/client.go 103 covered LOC · 39 ranges

Open complete file

152 // NewHTTPClient creates a new [HTTPClient] from provided [HTTPClientOptions].
153 // BaseURL and Service are required.
154 > func NewHTTPClient(options HTTPClientOptions) (*HTTPClient, error) { client.go
155 > if options.HTTPCaller == nil {
156 > options.HTTPCaller = http.DefaultClient.Do
157 > }
158 > if options.BaseURL == "" {
159 return nil, errors.New("empty BaseURL")
160 }
161 > if options.Service == "" { client.go
162 return nil, errors.New("empty Service")
163 }
164 > var baseURL *url.URL client.go
165 > var err error
166 > baseURL, err = url.Parse(options.BaseURL)
167 > if err != nil {
168 return nil, err
169 }
170 > if baseURL.Scheme != "http" && baseURL.Scheme != "https" { client.go
171 return nil, fmt.Errorf("invalid URL scheme: %s", baseURL.Scheme)
172 }
173 > if options.Serializer == nil { client.go
174 options.Serializer = nexus.DefaultSerializer()
175 }
176 > if options.FailureConverter == nil { client.go
177 > options.FailureConverter = DefaultFailureConverter() client.go
178 > }
179 > return &HTTPClient{ client.go
180 > baseHTTPClient: baseHTTPClient{
181 > serializer: options.Serializer,
182 > failureConverter: options.FailureConverter,
183 > httpCaller: options.HTTPCaller,
184 > },
185 > serviceBaseURL: baseURL,
186 > service: options.Service,
187 > }, nil
188 }
189
225 input any,
226 options nexus.StartOperationOptions,
227 > ) (*ClientStartOperationResponse[*nexus.LazyValue], error) { client.go
228 > var reader *nexus.Reader
229 > var contentLength *int64
230 > if r, ok := input.(*nexus.Reader); ok {
231 // Close the input reader in case we error before sending the HTTP request (which may double close but
232 // that's fine since we ignore the error).
234 defer r.Close()
235 reader = r
236 > } else { client.go
237 > content, ok := input.(*nexus.Content) client.go
238 > if !ok {
239 > var err error client.go
240 > content, err = c.serializer.Serialize(input)
241 > if err != nil {
242 return nil, err
243 }
244 }
245 > header := maps.Clone(content.Header) client.go
246 > if header == nil {
247 header = make(nexus.Header, 1)
248 }
249 > contentLength = new(int64) client.go
250 > *contentLength = int64(len(content.Data))
251 >
252 > reader = &nexus.Reader{
253 > ReadCloser: io.NopCloser(bytes.NewReader(content.Data)),
254 > Header: header,
255 > }
256 }
257
258 > url := c.serviceBaseURL.JoinPath(url.PathEscape(c.service), url.PathEscape(operation)) client.go
259 >
260 > if options.CallbackURL != "" {
261 > q := url.Query() client.go
262 > q.Set(queryCallbackURL, options.CallbackURL)
263 > url.RawQuery = q.Encode()
264 > }
265 > request, err := http.NewRequestWithContext(ctx, "POST", url.String(), reader) client.go
266 > if contentLength != nil {
267 > request.ContentLength = *contentLength client.go
268 > }
269 > if err != nil { client.go
270 return nil, err
271 }
272
273 > if options.RequestID == "" { client.go
274 options.RequestID = uuid.NewString()
275 }
276 > request.Header.Set(headerRequestID, options.RequestID) client.go
277 > request.Header.Set(headerUserAgent, userAgent)
278 > addContentHeaderToHTTPHeader(reader.Header, request.Header)
279 > addCallbackHeaderToHTTPHeader(options.CallbackHeader, request.Header)
280 > if err := addLinksToHTTPHeader(options.Links, request.Header); err != nil {
281 return nil, fmt.Errorf("failed to serialize links into header: %w", err)
282 }
283 > addContextTimeoutToHTTPHeader(ctx, request.Header) client.go
284 > addNexusHeaderToHTTPHeader(options.Header, request.Header)
285 >
286 > response, err := c.httpCaller(request)
287 > if err != nil {
288 return nil, err
289 }
290
291 > links, err := getLinksFromHeader(response.Header) client.go
292 > if err != nil {
293 // Have to read body here to check if it is a Failure.
294 body, err := readAndReplaceBody(response)
308
309 // Do not close response body here to allow successful result to read it.
310 > if response.StatusCode == http.StatusOK { client.go
311 return &ClientStartOperationResponse[*nexus.LazyValue]{
312 Successful: nexus.NewLazyValue(
322
323 // Do this once here and make sure it doesn't leak.
324 > body, err := readAndReplaceBody(response) client.go
325 > if err != nil {
326 return nil, err
327 }
328
329 > switch response.StatusCode { client.go
330 > case http.StatusCreated: client.go
331 > info, err := operationInfoFromResponse(response, body)
332 > if err != nil {
333 return nil, err
334 }
335 > if info.State != nexus.OperationStateRunning { client.go
336 return nil, newUnexpectedResponseError(fmt.Sprintf("invalid operation state in response info: %q", info.State), response, body)
337 }
338 > handle, err := c.NewOperationHandle(operation, info.Token) client.go
339 > if err != nil {
340 return nil, newUnexpectedResponseError("empty operation token in response", response, body)
341 }
342 > return &ClientStartOperationResponse[*nexus.LazyValue]{ client.go
343 > Pending: handle,
344 > Links: links,
345 > }, nil
346 case statusOperationUnsuccessful:
347 failure, err := c.failureFromResponse(response, body)
381 // Does not incur a trip to the server.
382 // Fails if provided an empty operation or token.
383 > func (c *HTTPClient) NewOperationHandle(operation string, token string) (*OperationHandle[*nexus.LazyValue], error) { client.go
384 > var es []error
385 > if operation == "" {
386 es = append(es, errEmptyOperationName)
387 }
388 > if token == "" { client.go
389 es = append(es, errEmptyOperationToken)
390 }
391 > if len(es) > 0 { client.go
392 return nil, errors.Join(es...)
393 }
394 > return &OperationHandle[*nexus.LazyValue]{ client.go
395 > client: c,
396 > Operation: operation,
397 > Token: token,
398 > }, nil
399 }
400
402 // body with an in-memory buffer.
403 // The body is replaced even when there was an error reading the entire body.
404 > func readAndReplaceBody(response *http.Response) ([]byte, error) { client.go
405 > responseBody := response.Body
406 > body, err := io.ReadAll(responseBody)
407 > if err := responseBody.Close(); err != nil {
408 return nil, err
409 }
410 > response.Body = io.NopCloser(bytes.NewReader(body)) client.go
411 > return body, err
412 }
413
414 > func operationInfoFromResponse(response *http.Response, body []byte) (*nexus.OperationInfo, error) { client.go
415 > if !isMediaTypeJSON(response.Header.Get("Content-Type")) {
416 return nil, newUnexpectedResponseError(fmt.Sprintf("invalid response content type: %q", response.Header.Get("Content-Type")), response, body)
417 }
418 > var info nexus.OperationInfo client.go
419 > if err := json.Unmarshal(body, &info); err != nil {
420 return nil, err
421 }
422 > return &info, nil client.go
423 }
424
go.temporal.io/server/common/nexus/nexusrpc/server.go 92 covered LOC · 30 ranges

Open complete file

19 )
20
21 > func applyResultToHTTPResponse(r nexus.HandlerStartOperationResult[any], writer http.ResponseWriter, request *http.Request, handler *httpHandler) { server.go
22 > switch r := r.(type) {
23 case interface{ ValueAsAny() any }:
24 handler.writeResult(writer, request, r.ValueAsAny())
25 > case *nexus.HandlerStartOperationResultAsync: server.go
26 > info := nexus.OperationInfo{
27 > Token: r.OperationToken,
28 > State: nexus.OperationStateRunning,
29 > }
30 > b, err := json.Marshal(info)
31 > if err != nil {
32 handler.Logger.Error("failed to serialize operation info", "error", err)
33 writer.WriteHeader(http.StatusInternalServerError)
35 }
36
37 > writer.Header().Set("Content-Type", contentTypeJSON) server.go
38 > writer.WriteHeader(http.StatusCreated)
39 > if _, err := writer.Write(b); err != nil {
40 handler.Logger.Error("failed to write response body", "error", err)
41 }
198 }
199
200 > func (h *httpHandler) startOperation(service, operation string, writer http.ResponseWriter, request *http.Request) { server.go
201 > links, err := getLinksFromHeader(request.Header)
202 > if err != nil {
203 h.WriteFailure(writer, request, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeBadRequest, "invalid %q header", headerLink))
204 return
205 }
206 > options := nexus.StartOperationOptions{ server.go
207 > RequestID: request.Header.Get(headerRequestID),
208 > CallbackURL: request.URL.Query().Get(queryCallbackURL),
209 > CallbackHeader: prefixStrippedHTTPHeaderToNexusHeader(request.Header, "nexus-callback-"),
210 > Header: httpHeaderToNexusHeader(request.Header, "content-", "nexus-callback-"),
211 > Links: links,
212 > }
213 > value := nexus.NewLazyValue(
214 > h.options.Serializer,
215 > &nexus.Reader{
216 > ReadCloser: request.Body,
217 > Header: prefixStrippedHTTPHeaderToNexusHeader(request.Header, "content-"),
218 > },
219 > )
220 >
221 > ctx, cancel, ok := h.contextWithTimeoutFromHTTPRequest(writer, request)
222 > if !ok {
223 return
224 }
225 > defer cancel() server.go
226 >
227 > ctx = nexus.WithHandlerContext(ctx, nexus.HandlerInfo{
228 > Service: service,
229 > Operation: operation,
230 > Header: options.Header,
231 > })
232 > response, err := h.options.Handler.StartOperation(ctx, service, operation, value, options)
233 > if err != nil {
234 h.WriteFailure(writer, request, err)
235 > } else { server.go
236 > if err := addLinksToHTTPHeader(nexus.HandlerLinks(ctx), writer.Header()); err != nil { server.go
237 h.Logger.Error("failed to serialize links into header", "error", err)
238 // clear any previous links already written to the header
241 return
242 }
243 > applyResultToHTTPResponse(response, writer, request, h) server.go
244 }
245 }
270 // Returns (0, true) if unset. Returns ({parsedDuration}, true) if set. If set and there is an error parsing the
271 // duration, it writes a failure response and returns (0, false).
272 > func (h *httpHandler) parseRequestTimeoutHeader(writer http.ResponseWriter, request *http.Request) (time.Duration, bool) { server.go
273 > timeoutStr := request.Header.Get(nexus.HeaderRequestTimeout)
274 > if timeoutStr != "" {
275 > timeoutDuration, err := ParseDuration(timeoutStr) server.go
276 > if err != nil {
277 h.Logger.Warn("invalid request timeout header", "timeout", timeoutStr)
278 h.WriteFailure(writer, request, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeBadRequest, "invalid request timeout header"))
279 return 0, false
280 }
281 > return timeoutDuration, true server.go
282 }
283 return 0, true
286 // contextWithTimeoutFromHTTPRequest extracts the context from the HTTP request and applies the timeout indicated by
287 // the Request-Timeout header, if set.
288 > func (h *httpHandler) contextWithTimeoutFromHTTPRequest(writer http.ResponseWriter, request *http.Request) (context.Context, context.CancelFunc, bool) { server.go
289 > requestTimeout, ok := h.parseRequestTimeoutHeader(writer, request)
290 > if !ok {
291 return nil, nil, false
292 }
293 > if requestTimeout > 0 { server.go
294 > ctx, cancel := context.WithTimeout(request.Context(), requestTimeout) server.go
295 > return ctx, cancel, true
296 > }
297 return request.Context(), func() {}, true
298 }
318 }
319
320 > func (h *httpHandler) handleRequest(writer http.ResponseWriter, request *http.Request) { server.go
321 > if request.Method != "POST" {
322 h.WriteFailure(writer, request, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeBadRequest, "invalid request method: expected POST, got %q", request.Method))
323 return
324 }
325 > parts := strings.Split(request.URL.EscapedPath(), "/") server.go
326 > // First part is empty (due to leading /)
327 > if len(parts) < 3 {
328 h.WriteFailure(writer, request, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeNotFound, "not found"))
329 return
330 }
331 > service, err := url.PathUnescape(parts[1]) server.go
332 > if err != nil {
333 h.WriteFailure(writer, request, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeBadRequest, "failed to parse URL path"))
334 return
335 }
336 > operation, err := url.PathUnescape(parts[2]) server.go
337 > if err != nil {
338 h.WriteFailure(writer, request, nexus.NewHandlerErrorf(nexus.HandlerErrorTypeBadRequest, "failed to parse URL path"))
339 return
341
342 // First handle StartOperation at /{service}/{operation}
343 > if len(parts) == 3 { server.go
344 > h.startOperation(service, operation, writer, request) server.go
345 > return
346 > }
347
348 // Handle deprecated /{service}/{operation}/{operation_token}/cancel
380
381 // NewHTTPHandler constructs an [http.Handler] from given options for handling Nexus service requests.
382 > func NewHTTPHandler(options HandlerOptions) http.Handler { server.go
383 > if options.Logger == nil {
384 > options.Logger = slog.Default() server.go
385 > }
386 > if options.GetResultTimeout == 0 { server.go
387 > options.GetResultTimeout = time.Minute server.go
388 > }
389 > if options.Serializer == nil { server.go
390 > options.Serializer = nexus.DefaultSerializer() server.go
391 > }
392 > if options.FailureConverter == nil { server.go
393 > options.FailureConverter = DefaultFailureConverter() server.go
394 > }
395 > handler := &httpHandler{ server.go
396 > BaseHTTPHandler: BaseHTTPHandler{
397 > Logger: options.Logger,
398 > FailureConverter: options.FailureConverter,
399 > },
400 > options: options,
401 > }
402 >
403 > return http.HandlerFunc(handler.handleRequest)
404 }
go.temporal.io/server/chasm/search_attribute.go 84 covered LOC · 13 ranges

Open complete file

136 }
137
138 > func newSearchAttributeFieldBool(index int) SearchAttributeFieldBool { search_attribute.go
139 > return SearchAttributeFieldBool{
140 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_BOOL, index),
141 > }
142 > }
143
144 // SearchAttributeFieldDateTime is a search attribute field for a datetime value.
147 }
148
149 > func newSearchAttributeFieldDateTime(index int) SearchAttributeFieldDateTime { search_attribute.go
150 > return SearchAttributeFieldDateTime{
151 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_DATETIME, index),
152 > }
153 > }
154
155 // SearchAttributeFieldInt is a search attribute field for an integer value.
158 }
159
160 > func newSearchAttributeFieldInt(index int) SearchAttributeFieldInt { search_attribute.go
161 > return SearchAttributeFieldInt{
162 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_INT, index),
163 > }
164 > }
165
166 // SearchAttributeFieldDouble is a search attribute field for a double value.
169 }
170
171 > func newSearchAttributeFieldDouble(index int) SearchAttributeFieldDouble { search_attribute.go
172 > return SearchAttributeFieldDouble{
173 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_DOUBLE, index),
174 > }
175 > }
176
177 // SearchAttributeFieldKeyword is a search attribute field for a keyword value.
180 }
181
182 > func newSearchAttributeFieldKeyword(index int) SearchAttributeFieldKeyword { search_attribute.go
183 > return SearchAttributeFieldKeyword{
184 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_KEYWORD, index),
185 > }
186 > }
187
188 > func newSearchAttributeFieldLowCardinalityKeyword(index int) SearchAttributeFieldKeyword { search_attribute.go
189 > return SearchAttributeFieldKeyword{
190 > field: fmt.Sprintf("%s%s%02d", sadefs.ReservedPrefix, "LowCardinalityKeyword", index),
191 > }
192 > }
193
194 // SearchAttributeFieldKeywordList is a search attribute field for a keyword list value.
197 }
198
199 > func newSearchAttributeFieldKeywordList(index int) SearchAttributeFieldKeywordList { search_attribute.go
200 > return SearchAttributeFieldKeywordList{
201 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST, index),
202 > }
203 > }
204
205 // SearchAttributeFieldText is a search attribute field for a text value.
214 }
215
216 > func resolveFieldName(valueType enumspb.IndexedValueType, index int) string { search_attribute.go
217 > // Columns are named like TemporalBool01, TemporalDatetime01, TemporalDouble01, TemporalInt01.
218 > return fmt.Sprintf("%s%s%02d", sadefs.ReservedPrefix, valueType.String(), index)
219 > }
220
221 func (s searchAttributeDefinition) definition() searchAttributeDefinition {
239 }
240
241 > func newSearchAttributeBoolByField(field string) SearchAttributeBool { search_attribute.go
242 > return SearchAttributeBool{
243 > searchAttributeDefinition: searchAttributeDefinition{
244 > alias: field,
245 > field: field,
246 > valueType: enumspb.INDEXED_VALUE_TYPE_BOOL,
247 > },
248 > }
249 > }
250
251 // Value sets the boolean value of the search attribute.
276 }
277
278 > func newSearchAttributeDateTimeByField(field string) SearchAttributeDateTime { search_attribute.go
279 > return SearchAttributeDateTime{
280 > searchAttributeDefinition: searchAttributeDefinition{
281 > alias: field,
282 > field: field,
283 > valueType: enumspb.INDEXED_VALUE_TYPE_DATETIME,
284 > },
285 > }
286 > }
287
288 // Value sets the date time value of the search attribute.
367
368 // NewSearchAttributeKeyword creates a new keyword search attribute given a predefined chasm field
369 > func NewSearchAttributeKeyword(alias string, keywordField SearchAttributeFieldKeyword) SearchAttributeKeyword { search_attribute.go
370 > return SearchAttributeKeyword{
371 > searchAttributeDefinition: searchAttributeDefinition{
372 > alias: alias,
373 > field: keywordField.field,
374 > valueType: enumspb.INDEXED_VALUE_TYPE_KEYWORD,
375 > },
376 > }
377 > }
378
379 > func newSearchAttributeKeywordByField(field string) SearchAttributeKeyword { search_attribute.go
380 > return SearchAttributeKeyword{
381 > searchAttributeDefinition: searchAttributeDefinition{
382 > alias: field,
383 > field: field,
384 > valueType: enumspb.INDEXED_VALUE_TYPE_KEYWORD,
385 > },
386 > }
387 > }
388
389 // Value sets the string value of the search attribute.
414 }
415
416 > func newSearchAttributeKeywordListByField(field string) SearchAttributeKeywordList { search_attribute.go
417 > return SearchAttributeKeywordList{
418 > searchAttributeDefinition: searchAttributeDefinition{
419 > alias: field,
420 > field: field,
421 > valueType: enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST,
422 > },
423 > }
424 > }
425
426 // Value sets the string list value of the search attribute.
go.temporal.io/server/api/persistence/v1/predicates.pb.go 82 covered LOC · 22 ranges

Open complete file

57 func (*Predicate) ProtoMessage() {}
58
59 > func (x *Predicate) ProtoReflect() protoreflect.Message { predicates.pb.go
60 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[0]
61 > if x != nil {
62 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
63 > if ms.LoadMessageInfo() == nil {
64 > ms.StoreMessageInfo(mi)
65 > }
66 > return ms
67 }
68 return mi.MessageOf(x)
261 func (*UniversalPredicateAttributes) ProtoMessage() {}
262
263 > func (x *UniversalPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
264 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[1]
265 > if x != nil {
266 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
267 if ms.LoadMessageInfo() == nil {
297 func (*EmptyPredicateAttributes) ProtoMessage() {}
298
299 > func (x *EmptyPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
300 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[2]
301 > if x != nil {
302 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
303 if ms.LoadMessageInfo() == nil {
334 func (*AndPredicateAttributes) ProtoMessage() {}
335
336 > func (x *AndPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
337 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[3]
338 > if x != nil {
339 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
340 if ms.LoadMessageInfo() == nil {
378 func (*OrPredicateAttributes) ProtoMessage() {}
379
380 > func (x *OrPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
381 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[4]
382 > if x != nil {
383 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
384 if ms.LoadMessageInfo() == nil {
422 func (*NotPredicateAttributes) ProtoMessage() {}
423
424 > func (x *NotPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
425 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[5]
426 > if x != nil {
427 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
428 if ms.LoadMessageInfo() == nil {
466 func (*NamespaceIdPredicateAttributes) ProtoMessage() {}
467
468 > func (x *NamespaceIdPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
469 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[6]
470 > if x != nil {
471 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
472 if ms.LoadMessageInfo() == nil {
510 func (*TaskTypePredicateAttributes) ProtoMessage() {}
511
512 > func (x *TaskTypePredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
513 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[7]
514 > if x != nil {
515 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
516 if ms.LoadMessageInfo() == nil {
554 func (*DestinationPredicateAttributes) ProtoMessage() {}
555
556 > func (x *DestinationPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
557 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[8]
558 > if x != nil {
559 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
560 if ms.LoadMessageInfo() == nil {
598 func (*OutboundTaskGroupPredicateAttributes) ProtoMessage() {}
599
600 > func (x *OutboundTaskGroupPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
601 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[9]
602 > if x != nil {
603 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
604 if ms.LoadMessageInfo() == nil {
642 func (*OutboundTaskPredicateAttributes) ProtoMessage() {}
643
644 > func (x *OutboundTaskPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
645 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[10]
646 > if x != nil {
647 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
648 if ms.LoadMessageInfo() == nil {
828 }
829
830 > func init() { file_temporal_server_api_persistence_v1_predicates_proto_init() } predicates.pb.go
831 > func file_temporal_server_api_persistence_v1_predicates_proto_init() {
832 > if File_temporal_server_api_persistence_v1_predicates_proto != nil {
833 > return
834 > }
835 > file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[0].OneofWrappers = []any{
836 > (*Predicate_UniversalPredicateAttributes)(nil),
837 > (*Predicate_EmptyPredicateAttributes)(nil),
838 > (*Predicate_AndPredicateAttributes)(nil),
839 > (*Predicate_OrPredicateAttributes)(nil),
840 > (*Predicate_NotPredicateAttributes)(nil),
841 > (*Predicate_NamespaceIdPredicateAttributes)(nil),
842 > (*Predicate_TaskTypePredicateAttributes)(nil),
843 > (*Predicate_DestinationPredicateAttributes)(nil),
844 > (*Predicate_OutboundTaskGroupPredicateAttributes)(nil),
845 > (*Predicate_OutboundTaskPredicateAttributes)(nil),
846 > }
847 > type x struct{}
848 > out := protoimpl.TypeBuilder{
849 > File: protoimpl.DescBuilder{
850 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
851 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_predicates_proto_rawDesc), len(file_temporal_server_api_persistence_v1_predicates_proto_rawDesc)),
852 > NumEnums: 0,
853 > NumMessages: 12,
854 > NumExtensions: 0,
855 > NumServices: 0,
856 > },
857 > GoTypes: file_temporal_server_api_persistence_v1_predicates_proto_goTypes,
858 > DependencyIndexes: file_temporal_server_api_persistence_v1_predicates_proto_depIdxs,
859 > MessageInfos: file_temporal_server_api_persistence_v1_predicates_proto_msgTypes,
860 > }.Build()
861 > File_temporal_server_api_persistence_v1_predicates_proto = out.File
862 > file_temporal_server_api_persistence_v1_predicates_proto_goTypes = nil
863 > file_temporal_server_api_persistence_v1_predicates_proto_depIdxs = nil
864 }
go.temporal.io/server/common/metrics/metrics_mock.go 81 covered LOC · 20 ranges

Open complete file

31
32 // NewMockHandler creates a new mock instance.
33 > func NewMockHandler(ctrl *gomock.Controller) *MockHandler { metrics_mock.go
34 > mock := &MockHandler{ctrl: ctrl}
35 > mock.recorder = &MockHandlerMockRecorder{mock}
36 > return mock
37 > }
38
39 // EXPECT returns an object that allows the caller to indicate expected use.
40 > func (m *MockHandler) EXPECT() *MockHandlerMockRecorder { metrics_mock.go
41 > return m.recorder
42 > }
43
44 // Counter mocks base method.
45 > func (m *MockHandler) Counter(arg0 string) CounterIface { metrics_mock.go
46 > m.ctrl.T.Helper()
47 > ret := m.ctrl.Call(m, "Counter", arg0)
48 > ret0, _ := ret[0].(CounterIface)
49 > return ret0
50 > }
51
52 // Counter indicates an expected call of Counter.
53 > func (mr *MockHandlerMockRecorder) Counter(arg0 any) *gomock.Call { metrics_mock.go
54 > mr.mock.ctrl.T.Helper()
55 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Counter", reflect.TypeOf((*MockHandler)(nil).Counter), arg0)
56 > }
57
58 // Gauge mocks base method.
111
112 // Timer mocks base method.
113 > func (m *MockHandler) Timer(arg0 string) TimerIface { metrics_mock.go
114 > m.ctrl.T.Helper()
115 > ret := m.ctrl.Call(m, "Timer", arg0)
116 > ret0, _ := ret[0].(TimerIface)
117 > return ret0
118 > }
119
120 // Timer indicates an expected call of Timer.
121 > func (mr *MockHandlerMockRecorder) Timer(arg0 any) *gomock.Call { metrics_mock.go
122 > mr.mock.ctrl.T.Helper()
123 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Timer", reflect.TypeOf((*MockHandler)(nil).Timer), arg0)
124 > }
125
126 // WithTags mocks base method.
127 > func (m *MockHandler) WithTags(arg0 ...Tag) Handler { metrics_mock.go
128 > m.ctrl.T.Helper()
129 > varargs := []any{}
130 > for _, a := range arg0 {
131 > varargs = append(varargs, a)
132 > }
133 > ret := m.ctrl.Call(m, "WithTags", varargs...)
134 > ret0, _ := ret[0].(Handler)
135 > return ret0
136 }
137
138 // WithTags indicates an expected call of WithTags.
139 > func (mr *MockHandlerMockRecorder) WithTags(arg0 ...any) *gomock.Call { metrics_mock.go
140 > mr.mock.ctrl.T.Helper()
141 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithTags", reflect.TypeOf((*MockHandler)(nil).WithTags), arg0...)
142 > }
143
144 // MockBatchHandler is a mock of BatchHandler interface.
293
294 // NewMockCounterIface creates a new mock instance.
295 > func NewMockCounterIface(ctrl *gomock.Controller) *MockCounterIface { metrics_mock.go
296 > mock := &MockCounterIface{ctrl: ctrl}
297 > mock.recorder = &MockCounterIfaceMockRecorder{mock}
298 > return mock
299 > }
300
301 // EXPECT returns an object that allows the caller to indicate expected use.
302 > func (m *MockCounterIface) EXPECT() *MockCounterIfaceMockRecorder { metrics_mock.go
303 > return m.recorder
304 > }
305
306 // Record mocks base method.
307 > func (m *MockCounterIface) Record(arg0 int64, arg1 ...Tag) { metrics_mock.go
308 > m.ctrl.T.Helper()
309 > varargs := []any{arg0}
310 > for _, a := range arg1 {
311 > varargs = append(varargs, a) metrics_mock.go
312 > }
313 > m.ctrl.Call(m, "Record", varargs...) metrics_mock.go
314 }
315
316 // Record indicates an expected call of Record.
317 > func (mr *MockCounterIfaceMockRecorder) Record(arg0 any, arg1 ...any) *gomock.Call { metrics_mock.go
318 > mr.mock.ctrl.T.Helper()
319 > varargs := append([]any{arg0}, arg1...)
320 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Record", reflect.TypeOf((*MockCounterIface)(nil).Record), varargs...)
321 > }
322
323 // MockGaugeIface is a mock of GaugeIface interface.
375
376 // NewMockTimerIface creates a new mock instance.
377 > func NewMockTimerIface(ctrl *gomock.Controller) *MockTimerIface { metrics_mock.go
378 > mock := &MockTimerIface{ctrl: ctrl}
379 > mock.recorder = &MockTimerIfaceMockRecorder{mock}
380 > return mock
381 > }
382
383 // EXPECT returns an object that allows the caller to indicate expected use.
384 > func (m *MockTimerIface) EXPECT() *MockTimerIfaceMockRecorder { metrics_mock.go
385 > return m.recorder
386 > }
387
388 // Record mocks base method.
389 > func (m *MockTimerIface) Record(arg0 time.Duration, arg1 ...Tag) { metrics_mock.go
390 > m.ctrl.T.Helper()
391 > varargs := []any{arg0}
392 > for _, a := range arg1 {
393 > varargs = append(varargs, a) metrics_mock.go
394 > }
395 > m.ctrl.Call(m, "Record", varargs...) metrics_mock.go
396 }
397
398 // Record indicates an expected call of Record.
399 > func (mr *MockTimerIfaceMockRecorder) Record(arg0 any, arg1 ...any) *gomock.Call { metrics_mock.go
400 > mr.mock.ctrl.T.Helper()
401 > varargs := append([]any{arg0}, arg1...)
402 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Record", reflect.TypeOf((*MockTimerIface)(nil).Record), varargs...)
403 > }
404
405 // MockHistogramIface is a mock of HistogramIface interface.
go.temporal.io/server/components/nexusoperations/statemachine.go 74 covered LOC · 22 ranges

Open complete file

34
35 // MachineCollection creates a new typed [statemachines.Collection] for operations.
36 > func MachineCollection(tree *hsm.Node) hsm.Collection[Operation] { statemachine.go
37 > return hsm.NewCollection[Operation](tree, OperationMachineType)
38 > }
39
40 // Operation state machine.
44
45 // AddChild adds a new operation child machine to the given node and transitions it to the SCHEDULED state.
46 > func AddChild(node *hsm.Node, id string, event *historypb.HistoryEvent, eventToken []byte) (*hsm.Node, error) { statemachine.go
47 > attrs := event.GetNexusOperationScheduledEventAttributes()
48 >
49 > node, err := node.AddChild(hsm.Key{Type: OperationMachineType, ID: id}, Operation{
50 > &persistencespb.NexusOperationInfo{
51 > EndpointId: attrs.EndpointId,
52 > Endpoint: attrs.Endpoint,
53 > Service: attrs.Service,
54 > Operation: attrs.Operation,
55 > ScheduledTime: event.EventTime,
56 > ScheduleToCloseTimeout: attrs.ScheduleToCloseTimeout,
57 > ScheduleToStartTimeout: attrs.ScheduleToStartTimeout,
58 > StartToCloseTimeout: attrs.StartToCloseTimeout,
59 > RequestId: attrs.RequestId,
60 > State: enumsspb.NEXUS_OPERATION_STATE_UNSPECIFIED,
61 > ScheduledEventToken: eventToken,
62 > },
63 > })
64 >
65 > if err != nil {
66 return nil, err
67 }
68
69 > return node, hsm.MachineTransition(node, func(op Operation) (hsm.TransitionOutput, error) { statemachine.go
70 > output, err := TransitionScheduled.Apply(op, EventScheduled{Node: node})
71 > if err != nil {
72 return output, err
73 }
74 > creationTasks, err := op.creationTasks() statemachine.go
75 > if err != nil {
76 return output, err
77 }
78 > output.Tasks = append(output.Tasks, creationTasks...) statemachine.go
79 > return output, err
80 })
81 }
82
83 > func (o Operation) State() enumsspb.NexusOperationState { statemachine.go
84 > return o.NexusOperationInfo.State
85 > }
86
87 > func (o Operation) SetState(state enumsspb.NexusOperationState) { statemachine.go
88 > o.NexusOperationInfo.State = state
89 > }
90
91 func (o Operation) recordAttempt(ts time.Time) {
127
128 // transitionTasks returns tasks that are emitted as transition outputs.
129 > func (o Operation) transitionTasks() ([]hsm.Task, error) { statemachine.go
130 > switch o.State() { // nolint:exhaustive
131 case enumsspb.NEXUS_OPERATION_STATE_BACKING_OFF:
132 return []hsm.Task{BackoffTask{deadline: o.NextAttemptScheduleTime.AsTime()}}, nil
133 > case enumsspb.NEXUS_OPERATION_STATE_SCHEDULED: statemachine.go
134 > return []hsm.Task{InvocationTask{EndpointName: o.Endpoint, Attempt: o.Attempt}}, nil
135 > default: statemachine.go
136 > return nil, nil
137 }
138 }
139
140 // creationTasks returns tasks that are emitted when the machine is created.
141 > func (o Operation) creationTasks() ([]hsm.Task, error) { statemachine.go
142 > var tasks []hsm.Task
143 >
144 > if o.ScheduleToCloseTimeout.AsDuration() != 0 {
145 tasks = append(tasks, ScheduleToCloseTimeoutTask{
146 deadline: o.ScheduledTime.AsTime().Add(o.ScheduleToCloseTimeout.AsDuration()),
148 }
149
150 > if o.ScheduleToStartTimeout.AsDuration() != 0 { statemachine.go
151 tasks = append(tasks, ScheduleToStartTimeoutTask{
152 deadline: o.ScheduledTime.AsTime().Add(o.ScheduleToStartTimeout.AsDuration()),
182 }
183
184 > func (o Operation) output() (hsm.TransitionOutput, error) { statemachine.go
185 > tasks, err := o.transitionTasks()
186 > if err != nil {
187 return hsm.TransitionOutput{}, err
188 }
189 > return hsm.TransitionOutput{Tasks: tasks}, nil statemachine.go
190 }
191
192 type operationMachineDefinition struct{}
193
194 > func (operationMachineDefinition) Type() string { statemachine.go
195 > return OperationMachineType
196 > }
197
198 func (operationMachineDefinition) Deserialize(d []byte) (any, error) {
201 }
202
203 > func (operationMachineDefinition) Serialize(state any) ([]byte, error) { statemachine.go
204 > if state, ok := state.(Operation); ok {
205 > return proto.Marshal(state.NexusOperationInfo)
206 > }
207 return nil, fmt.Errorf("invalid operation provided: %v", state)
208 }
246 []enumsspb.NexusOperationState{enumsspb.NEXUS_OPERATION_STATE_UNSPECIFIED},
247 enumsspb.NEXUS_OPERATION_STATE_SCHEDULED,
248 > func(op Operation, event EventScheduled) (hsm.TransitionOutput, error) { statemachine.go
249 > return op.output()
250 > },
251 )
252
303 },
304 enumsspb.NEXUS_OPERATION_STATE_FAILED,
305 > func(op Operation, event EventFailed) (hsm.TransitionOutput, error) { statemachine.go
306 > // Not recording the last attempt information here since the state machine will be deleted immediately after this transition.
307 > // If we ever use this code for a standalone state machine implementation we will want to record the last
308 > // attempt information in case the completion is a result of a synchronous operation.
309 > return op.output()
310 > },
311 )
312
488 }
489
490 > func (cancelationMachineDefinition) Type() string { statemachine.go
491 > return CancelationMachineType
492 > }
493
494 // CompareState compares the progress of two Cancelation state machines to determine whether to sync machine state while
675 )
676
677 > func RegisterStateMachines(r *hsm.Registry) error { statemachine.go
678 > if err := r.RegisterMachine(operationMachineDefinition{}); err != nil {
679 return err
680 }
681 > return r.RegisterMachine(cancelationMachineDefinition{}) statemachine.go
682 }
go.temporal.io/server/components/nexusoperations/events.go 73 covered LOC · 30 ranges

Open complete file

17 }
18
19 > func (d ScheduledEventDefinition) Type() enumspb.EventType { events.go
20 > return enumspb.EVENT_TYPE_NEXUS_OPERATION_SCHEDULED
21 > }
22
23 func (d ScheduledEventDefinition) Apply(root *hsm.Node, event *historypb.HistoryEvent) error {
41 }
42
43 > func (d CancelRequestedEventDefinition) Type() enumspb.EventType { events.go
44 > return enumspb.EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUESTED
45 > }
46
47 func (d CancelRequestedEventDefinition) Apply(root *hsm.Node, event *historypb.HistoryEvent) error {
64 }
65
66 > func (d CancelRequestCompletedEventDefinition) Type() enumspb.EventType { events.go
67 > return enumspb.EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_COMPLETED
68 > }
69
70 func (d CancelRequestCompletedEventDefinition) Apply(root *hsm.Node, event *historypb.HistoryEvent) error {
98 }
99
100 > func (d CancelRequestFailedEventDefinition) Type() enumspb.EventType { events.go
101 > return enumspb.EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_FAILED
102 > }
103
104 func (d CancelRequestFailedEventDefinition) Apply(root *hsm.Node, event *historypb.HistoryEvent) error {
133 }
134
135 > func (d StartedEventDefinition) Type() enumspb.EventType { events.go
136 > return enumspb.EVENT_TYPE_NEXUS_OPERATION_STARTED
137 > }
138
139 func (d StartedEventDefinition) Apply(root *hsm.Node, event *historypb.HistoryEvent) error {
176 }
177
178 > func (d CompletedEventDefinition) Type() enumspb.EventType { events.go
179 > return enumspb.EVENT_TYPE_NEXUS_OPERATION_COMPLETED
180 > }
181
182 func (d CompletedEventDefinition) CherryPick(root *hsm.Node, event *historypb.HistoryEvent, excludeTypes map[enumspb.ResetReapplyExcludeType]struct{}) error {
193 }
194
195 > func (d FailedEventDefinition) Type() enumspb.EventType { events.go
196 > return enumspb.EVENT_TYPE_NEXUS_OPERATION_FAILED
197 > }
198
199 > func (d FailedEventDefinition) Apply(root *hsm.Node, event *historypb.HistoryEvent) error { events.go
200 > node, err := transitionOperation(root, event, func(node *hsm.Node, o Operation) (hsm.TransitionOutput, error) {
201 > return TransitionFailed.Apply(o, EventFailed{
202 > Time: event.EventTime.AsTime(),
203 > Attributes: event.GetNexusOperationFailedEventAttributes(),
204 > Node: node,
205 > })
206 > })
207 > if err != nil {
208 return err
209 }
210
211 > return node.Parent.DeleteChild(node.Key) events.go
212 }
213
225 }
226
227 > func (d CanceledEventDefinition) Type() enumspb.EventType { events.go
228 > return enumspb.EVENT_TYPE_NEXUS_OPERATION_CANCELED
229 > }
230
231 func (d CanceledEventDefinition) Apply(root *hsm.Node, event *historypb.HistoryEvent) error {
256 }
257
258 > func (d TimedOutEventDefinition) Type() enumspb.EventType { events.go
259 > return enumspb.EVENT_TYPE_NEXUS_OPERATION_TIMED_OUT
260 > }
261
262 func (d TimedOutEventDefinition) Apply(root *hsm.Node, event *historypb.HistoryEvent) error {
280 }
281
282 > func RegisterEventDefinitions(reg *hsm.Registry) error { events.go
283 > if err := reg.RegisterEventDefinition(ScheduledEventDefinition{}); err != nil {
284 return err
285 }
286 > if err := reg.RegisterEventDefinition(CancelRequestedEventDefinition{}); err != nil { events.go
287 return err
288 }
289 > if err := reg.RegisterEventDefinition(CancelRequestCompletedEventDefinition{}); err != nil { events.go
290 return err
291 }
292 > if err := reg.RegisterEventDefinition(CancelRequestFailedEventDefinition{}); err != nil { events.go
293 return err
294 }
295 > if err := reg.RegisterEventDefinition(StartedEventDefinition{}); err != nil { events.go
296 return err
297 }
298 > if err := reg.RegisterEventDefinition(CompletedEventDefinition{}); err != nil { events.go
299 return err
300 }
301 > if err := reg.RegisterEventDefinition(FailedEventDefinition{}); err != nil { events.go
302 return err
303 }
304 > if err := reg.RegisterEventDefinition(CanceledEventDefinition{}); err != nil { events.go
305 return err
306 }
307 > return reg.RegisterEventDefinition(TimedOutEventDefinition{}) events.go
308 }
309
312 event *historypb.HistoryEvent,
313 fn func(node *hsm.Node, o Operation) (hsm.TransitionOutput, error),
314 > ) (*hsm.Node, error) { events.go
315 > node, err := findOperationNode(root, event)
316 > if err != nil {
317 return nil, err
318 }
319 > if err := hsm.MachineTransition(node, func(o Operation) (hsm.TransitionOutput, error) { events.go
320 > return fn(node, o)
321 > }); err != nil {
322 return nil, err
323 }
324 > return node, nil events.go
325 }
326
327 > func findOperationNode(root *hsm.Node, event *historypb.HistoryEvent) (*hsm.Node, error) { events.go
328 > attrs := reflect.ValueOf(event.Attributes).Elem()
329 >
330 > // Attributes is always a struct with a single field (e.g: HistoryEvent_NexusOperationScheduledEventAttributes)
331 > if attrs.Kind() != reflect.Struct || attrs.NumField() != 1 {
332 panic("invalid event, expected Attributes field with a single field struct")
333 }
334
335 > f := attrs.Field(0).Interface() events.go
336 >
337 > eventIDGetter, ok := f.(interface{ GetScheduledEventId() int64 })
338 > if !ok {
339 panic("Event does not have a ScheduledEventId field")
340 }
341 > coll := MachineCollection(root) events.go
342 > nodeID := strconv.FormatInt(eventIDGetter.GetScheduledEventId(), 10)
343 > node, err := coll.Node(nodeID)
344 > if err != nil {
345 return nil, err
346 }
347 > requestIDGetter, ok := f.(interface{ GetRequestId() string }) events.go
348 > if ok && requestIDGetter.GetRequestId() != "" {
349 > op, err := coll.Data(nodeID) events.go
350 > if err != nil {
351 return nil, err
352 }
353 > if op.RequestId != requestIDGetter.GetRequestId() { events.go
354 return nil, fmt.Errorf("%w: event has different request ID (%q) than the machine (%q)",
355 hsm.ErrNotCherryPickable, requestIDGetter.GetRequestId(), op.RequestId)
356 }
357 }
358 > return node, nil events.go
359 }
go.temporal.io/server/api/persistence/v1/executions.pb.go 68 covered LOC · 2 ranges

Open complete file

4078 func (*NexusOperationInfo) ProtoMessage() {}
4079
4080 > func (x *NexusOperationInfo) ProtoReflect() protoreflect.Message { executions.pb.go
4081 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[26]
4082 > if x != nil {
4083 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
4084 > if ms.LoadMessageInfo() == nil {
4085 > ms.StoreMessageInfo(mi)
4086 > }
4087 > return ms
4088 }
4089 return mi.MessageOf(x)
5706 }
5707
5708 > func init() { file_temporal_server_api_persistence_v1_executions_proto_init() } executions.pb.go
5709 > func file_temporal_server_api_persistence_v1_executions_proto_init() {
5710 > if File_temporal_server_api_persistence_v1_executions_proto != nil {
5711 > return
5712 > }
5713 > file_temporal_server_api_persistence_v1_chasm_proto_init()
5714 > file_temporal_server_api_persistence_v1_hsm_proto_init()
5715 > file_temporal_server_api_persistence_v1_queues_proto_init()
5716 > file_temporal_server_api_persistence_v1_update_proto_init()
5717 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[1].OneofWrappers = []any{
5718 > (*WorkflowExecutionInfo_LastWorkflowTaskFailureCause)(nil),
5719 > (*WorkflowExecutionInfo_LastWorkflowTaskTimedOutType)(nil),
5720 > }
5721 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[8].OneofWrappers = []any{
5722 > (*TransferTaskInfo_CloseExecutionTaskDetails_)(nil),
5723 > (*TransferTaskInfo_ChasmTaskInfo)(nil),
5724 > }
5725 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[10].OneofWrappers = []any{
5726 > (*VisibilityTaskInfo_ChasmTaskInfo)(nil),
5727 > }
5728 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[11].OneofWrappers = []any{
5729 > (*TimerTaskInfo_ChasmTaskInfo)(nil),
5730 > }
5731 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[13].OneofWrappers = []any{
5732 > (*OutboundTaskInfo_StateMachineInfo)(nil),
5733 > (*OutboundTaskInfo_ChasmTaskInfo)(nil),
5734 > (*OutboundTaskInfo_WorkerCommandsTask)(nil),
5735 > }
5736 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[17].OneofWrappers = []any{
5737 > (*ActivityInfo_UseWorkflowBuildIdInfo_)(nil),
5738 > (*ActivityInfo_LastIndependentlyAssignedBuildId)(nil),
5739 > }
5740 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[23].OneofWrappers = []any{
5741 > (*Callback_Nexus_)(nil),
5742 > (*Callback_Hsm)(nil),
5743 > }
5744 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[40].OneofWrappers = []any{
5745 > (*ActivityInfo_PauseInfo_Manual_)(nil),
5746 > (*ActivityInfo_PauseInfo_RuleId)(nil),
5747 > }
5748 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[46].OneofWrappers = []any{
5749 > (*CallbackInfo_Trigger_WorkflowClosed)(nil),
5750 > }
5751 > type x struct{}
5752 > out := protoimpl.TypeBuilder{
5753 > File: protoimpl.DescBuilder{
5754 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
5755 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_executions_proto_rawDesc), len(file_temporal_server_api_persistence_v1_executions_proto_rawDesc)),
5756 > NumEnums: 0,
5757 > NumMessages: 47,
5758 > NumExtensions: 0,
5759 > NumServices: 0,
5760 > },
5761 > GoTypes: file_temporal_server_api_persistence_v1_executions_proto_goTypes,
5762 > DependencyIndexes: file_temporal_server_api_persistence_v1_executions_proto_depIdxs,
5763 > MessageInfos: file_temporal_server_api_persistence_v1_executions_proto_msgTypes,
5764 > }.Build()
5765 > File_temporal_server_api_persistence_v1_executions_proto = out.File
5766 > file_temporal_server_api_persistence_v1_executions_proto_goTypes = nil
5767 > file_temporal_server_api_persistence_v1_executions_proto_depIdxs = nil
5768 }
go.temporal.io/server/api/persistence/v1/hsm.pb.go 65 covered LOC · 16 ranges

Open complete file

147 func (*StateMachineMap) ProtoMessage() {}
148
149 > func (x *StateMachineMap) ProtoReflect() protoreflect.Message { hsm.pb.go
150 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[1]
151 > if x != nil {
152 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
153 if ms.LoadMessageInfo() == nil {
156 return ms
157 }
158 > return mi.MessageOf(x) hsm.pb.go
159 }
160
194 func (*StateMachineKey) ProtoMessage() {}
195
196 > func (x *StateMachineKey) ProtoReflect() protoreflect.Message { hsm.pb.go
197 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[2]
198 > if x != nil {
199 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
200 if ms.LoadMessageInfo() == nil {
203 return ms
204 }
205 > return mi.MessageOf(x) hsm.pb.go
206 }
207
272 func (*StateMachineRef) ProtoMessage() {}
273
274 > func (x *StateMachineRef) ProtoReflect() protoreflect.Message { hsm.pb.go
275 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[3]
276 > if x != nil {
277 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) hsm.pb.go
278 > if ms.LoadMessageInfo() == nil {
279 > ms.StoreMessageInfo(mi)
280 > }
281 > return ms
282 }
283 > return mi.MessageOf(x) hsm.pb.go
284 }
285
349 func (*StateMachineTaskInfo) ProtoMessage() {}
350
351 > func (x *StateMachineTaskInfo) ProtoReflect() protoreflect.Message { hsm.pb.go
352 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[4]
353 > if x != nil {
354 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
355 if ms.LoadMessageInfo() == nil {
358 return ms
359 }
360 > return mi.MessageOf(x) hsm.pb.go
361 }
362
416 func (*StateMachineTimerGroup) ProtoMessage() {}
417
418 > func (x *StateMachineTimerGroup) ProtoReflect() protoreflect.Message { hsm.pb.go
419 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[5]
420 > if x != nil {
421 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
422 if ms.LoadMessageInfo() == nil {
425 return ms
426 }
427 > return mi.MessageOf(x) hsm.pb.go
428 }
429
478 func (*VersionedTransition) ProtoMessage() {}
479
480 > func (x *VersionedTransition) ProtoReflect() protoreflect.Message { hsm.pb.go
481 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[6]
482 > if x != nil {
483 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
484 if ms.LoadMessageInfo() == nil {
487 return ms
488 }
489 > return mi.MessageOf(x) hsm.pb.go
490 }
491
531 func (*StateMachineTombstoneBatch) ProtoMessage() {}
532
533 > func (x *StateMachineTombstoneBatch) ProtoReflect() protoreflect.Message { hsm.pb.go
534 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[7]
535 > if x != nil {
536 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
537 if ms.LoadMessageInfo() == nil {
540 return ms
541 }
542 > return mi.MessageOf(x) hsm.pb.go
543 }
544
895 }
896
897 > func init() { file_temporal_server_api_persistence_v1_hsm_proto_init() } hsm.pb.go
898 > func file_temporal_server_api_persistence_v1_hsm_proto_init() {
899 > if File_temporal_server_api_persistence_v1_hsm_proto != nil {
900 > return
901 > }
902 > file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[8].OneofWrappers = []any{
903 > (*StateMachineTombstone_ActivityScheduledEventId)(nil),
904 > (*StateMachineTombstone_TimerId)(nil),
905 > (*StateMachineTombstone_ChildExecutionInitiatedEventId)(nil),
906 > (*StateMachineTombstone_RequestCancelInitiatedEventId)(nil),
907 > (*StateMachineTombstone_SignalExternalInitiatedEventId)(nil),
908 > (*StateMachineTombstone_UpdateId)(nil),
909 > (*StateMachineTombstone_StateMachinePath)(nil),
910 > (*StateMachineTombstone_ChasmNodePath)(nil),
911 > }
912 > type x struct{}
913 > out := protoimpl.TypeBuilder{
914 > File: protoimpl.DescBuilder{
915 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
916 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_hsm_proto_rawDesc), len(file_temporal_server_api_persistence_v1_hsm_proto_rawDesc)),
917 > NumEnums: 0,
918 > NumMessages: 12,
919 > NumExtensions: 0,
920 > NumServices: 0,
921 > },
922 > GoTypes: file_temporal_server_api_persistence_v1_hsm_proto_goTypes,
923 > DependencyIndexes: file_temporal_server_api_persistence_v1_hsm_proto_depIdxs,
924 > MessageInfos: file_temporal_server_api_persistence_v1_hsm_proto_msgTypes,
925 > }.Build()
926 > File_temporal_server_api_persistence_v1_hsm_proto = out.File
927 > file_temporal_server_api_persistence_v1_hsm_proto_goTypes = nil
928 > file_temporal_server_api_persistence_v1_hsm_proto_depIdxs = nil
929 }
go.temporal.io/server/service/history/hsm/registry.go 56 covered LOC · 15 ranges

Open complete file

47
48 // NewRegistry creates a new [Registry].
49 > func NewRegistry() *Registry { registry.go
50 > return &Registry{
51 > machines: make(map[string]StateMachineDefinition),
52 > tasks: make(map[string]TaskSerializer),
53 > immediateExecutors: make(map[string]any),
54 > timerExecutors: make(map[string]any),
55 > remoteExecutors: make(map[string]remoteMethodDefinition),
56 > events: make(map[enumspb.EventType]EventDefinition),
57 > }
58 > }
59
60 // RegisterMachine registers a [StateMachineDefinition] by its type.
61 // Returns an [ErrDuplicateRegistration] if the state machine type has already been registered.
62 > func (r *Registry) RegisterMachine(sm StateMachineDefinition) error { registry.go
63 > t := sm.Type()
64 > if existing, ok := r.machines[t]; ok {
65 return fmt.Errorf("%w: state machine already registered for %v - %v", ErrDuplicateRegistration, sm.Type(), existing.Type())
66 }
67 > r.machines[t] = sm registry.go
68 > return nil
69 }
70
71 // Machine returns a [StateMachineDefinition] for a given type and a boolean indicating whether it was found.
72 > func (r *Registry) Machine(t string) (def StateMachineDefinition, ok bool) { registry.go
73 > def, ok = r.machines[t]
74 > return
75 > }
76
77 // RegisterTaskSerializer registers a [TaskSerializer] for a given type.
93 // RegisterImmediateExecutor registers an [ImmediateExecutor] for the given task type.
94 // Returns an [ErrDuplicateRegistration] if an executor for the type has already been registered.
95 > func RegisterImmediateExecutor[T Task](r *Registry, executor ImmediateExecutor[T]) error { registry.go
96 > var task T
97 > taskType := task.Type()
98 > // The executors are registered in pairs, so only need to check in one map.
99 > if existing, ok := r.immediateExecutors[taskType]; ok {
100 return fmt.Errorf(
101 "%w: executor already registered for task type %v: %v",
105 )
106 }
107 > r.immediateExecutors[taskType] = executor registry.go
108 > return nil
109 }
110
131 // RegisterTimerExecutor registers a [TimerExecutor] for the given task type.
132 // Returns an [ErrDuplicateRegistration] if an executor for the type has already been registered.
133 > func RegisterTimerExecutor[T Task](r *Registry, executor TimerExecutor[T]) error { registry.go
134 > var task T
135 > taskType := task.Type()
136 > // The executors are registered in pairs, so only need to check in one map.
137 > if existing, ok := r.timerExecutors[taskType]; ok {
138 return fmt.Errorf(
139 "%w: executor already registered for task type %v: %v",
143 )
144 }
145 > r.timerExecutors[taskType] = executor registry.go
146 > return nil
147 }
148
154 ref Ref,
155 task Task,
156 > ) error { registry.go
157 > executor, ok := r.immediateExecutors[task.Type()]
158 > if !ok {
159 return fmt.Errorf("%w: executor for task type %v", ErrNotRegistered, task.Type())
160 }
161 > return r.execute(ctx, executor, env, ref, task) registry.go
162 }
163
169 ref Ref,
170 task Task,
171 > ) error { registry.go
172 > if executor == nil {
173 return nil
174 }
175 > fn := reflect.ValueOf(executor) registry.go
176 > values := fn.Call(
177 > []reflect.Value{
178 > reflect.ValueOf(ctx),
179 > reflect.ValueOf(env),
180 > reflect.ValueOf(ref),
181 > reflect.ValueOf(task),
182 > },
183 > )
184 > if !values[0].IsNil() {
185 //nolint:revive // type cast result is unchecked
186 return values[0].Interface().(error)
187 }
188 > return nil registry.go
189 }
190
262 // RegisterEventDefinition registers an [EventDefinition] for the given event type.
263 // Returns an [ErrDuplicateRegistration] if a definition for the type has already been registered.
264 > func (r *Registry) RegisterEventDefinition(def EventDefinition) error { registry.go
265 > t := def.Type()
266 > prev, ok := r.events[t]
267 > if ok {
268 return fmt.Errorf("%w: event definition for event type %v: %v", ErrDuplicateRegistration, t, prev)
269 }
270 > r.events[t] = def registry.go
271 > return nil
272 }
273
go.temporal.io/server/common/metrics/metricstest/capture_handler.go 55 covered LOC · 13 ranges

Open complete file

38 }
39
40 > func (c *Capture) record(name string, r *CapturedRecording) { capture_handler.go
41 > c.recordingsLock.Lock()
42 > defer c.recordingsLock.Unlock()
43 > c.recordings[name] = append(c.recordings[name], r)
44 > }
45
46 // CaptureHandler is a [metrics.Handler] that captures each metric recording.
55
56 // NewCaptureHandler creates a new [metrics.Handler] that captures.
57 > func NewCaptureHandler() *CaptureHandler { capture_handler.go
58 > return &CaptureHandler{
59 > captures: map[*Capture]struct{}{},
60 > capturesLock: &sync.RWMutex{},
61 > captureCount: &atomic.Int32{},
62 > }
63 > }
64
65 // StartCapture returns a started capture. StopCapture should be called on
66 // complete.
67 > func (c *CaptureHandler) StartCapture() *Capture { capture_handler.go
68 > capture := &Capture{recordings: make(CaptureSnapshot)}
69 > c.capturesLock.Lock()
70 > defer c.capturesLock.Unlock()
71 >
72 > c.captures[capture] = struct{}{}
73 > c.captureCount.Add(1)
74 > return capture
75 > }
76
77 // StopCapture stops capturing metrics for the given capture instance.
78 > func (c *CaptureHandler) StopCapture(capture *Capture) { capture_handler.go
79 > c.capturesLock.Lock()
80 > defer c.capturesLock.Unlock()
81 >
82 > delete(c.captures, capture)
83 > c.captureCount.Add(-1)
84 > }
85
86 // WithTags implements [metrics.Handler.WithTags].
87 > func (c *CaptureHandler) WithTags(tags ...metrics.Tag) metrics.Handler { capture_handler.go
88 > return &CaptureHandler{
89 > tags: append(append(make([]metrics.Tag, 0, len(c.tags)+len(tags)), c.tags...), tags...),
90 > captures: c.captures,
91 > capturesLock: c.capturesLock,
92 > captureCount: c.captureCount,
93 > }
94 > }
95
96 > func (c *CaptureHandler) record(name string, v any, unit metrics.MetricUnit, tags ...metrics.Tag) { capture_handler.go
97 > // If no captures are active, discard the metric to save memory.
98 > if c.captureCount.Load() == 0 {
99 return
100 }
101
102 > rec := &CapturedRecording{Value: v, Tags: make(map[string]string, len(c.tags)+len(tags)), Unit: unit} capture_handler.go
103 > for _, tag := range c.tags {
104 > rec.Tags[tag.Key] = tag.Value capture_handler.go
105 > }
106 > for _, tag := range tags { capture_handler.go
107 > rec.Tags[tag.Key] = tag.Value capture_handler.go
108 > }
109 > c.capturesLock.RLock() capture_handler.go
110 > defer c.capturesLock.RUnlock()
111 > for cap := range c.captures {
112 > cap.record(name, rec)
113 > }
114 }
115
116 // Counter implements [metrics.Handler.Counter].
117 > func (c *CaptureHandler) Counter(name string) metrics.CounterIface { capture_handler.go
118 > return metrics.CounterFunc(func(v int64, tags ...metrics.Tag) { c.record(name, v, "", tags...) })
119 }
120
125
126 // Timer implements [metrics.Handler.Timer].
127 > func (c *CaptureHandler) Timer(name string) metrics.TimerIface { capture_handler.go
128 > return metrics.TimerFunc(func(v time.Duration, tags ...metrics.Tag) { c.record(name, v, "", tags...) })
129 }
130
go.temporal.io/server/common/namespace/testconstructors.go 52 covered LOC · 11 ranges

Open complete file

13 config *persistencespb.NamespaceConfig,
14 targetCluster string,
15 > ) *Namespace { testconstructors.go
16 > detail := &persistencespb.NamespaceDetail{
17 > Info: ensureInfo(info),
18 > Config: ensureConfig(config),
19 > ReplicationConfig: &persistencespb.NamespaceReplicationConfig{
20 > ActiveClusterName: targetCluster,
21 > Clusters: []string{targetCluster},
22 > },
23 > FailoverVersion: common.EmptyVersion,
24 > }
25 > factory := NewDefaultReplicationResolverFactory()
26 > resolver := factory(detail)
27 > ns, _ := FromPersistentState(detail, resolver, WithGlobalFlag(false))
28 > return ns
29 > }
30
31 // NewNamespaceForTest returns an entry with test data
36 repConfig *persistencespb.NamespaceReplicationConfig,
37 failoverVersion int64,
38 > ) *Namespace { testconstructors.go
39 > detail := &persistencespb.NamespaceDetail{
40 > Info: ensureInfo(info),
41 > Config: ensureConfig(config),
42 > ReplicationConfig: ensureRepConfig(repConfig),
43 > FailoverVersion: failoverVersion,
44 > }
45 > factory := NewDefaultReplicationResolverFactory()
46 > resolver := factory(detail)
47 > ns, _ := FromPersistentState(detail, resolver, WithGlobalFlag(isGlobalNamespace))
48 > return ns
49 > }
50
51 // newGlobalNamespaceForTest returns an entry with test data
55 repConfig *persistencespb.NamespaceReplicationConfig,
56 failoverVersion int64,
57 > ) *Namespace { testconstructors.go
58 > detail := &persistencespb.NamespaceDetail{
59 > Info: ensureInfo(info),
60 > Config: ensureConfig(config),
61 > ReplicationConfig: ensureRepConfig(repConfig),
62 > FailoverVersion: failoverVersion,
63 > }
64 > factory := NewDefaultReplicationResolverFactory()
65 > resolver := factory(detail)
66 > ns, _ := FromPersistentState(detail, resolver, WithGlobalFlag(true))
67 > return ns
68 > }
69
70 > func ensureInfo(proto *persistencespb.NamespaceInfo) *persistencespb.NamespaceInfo { testconstructors.go
71 > if proto == nil {
72 return &persistencespb.NamespaceInfo{}
73 }
74 > return proto testconstructors.go
75 }
76
77 > func ensureConfig(proto *persistencespb.NamespaceConfig) *persistencespb.NamespaceConfig { testconstructors.go
78 > if proto == nil {
79 > return &persistencespb.NamespaceConfig{} testconstructors.go
80 > }
81 > return proto testconstructors.go
82 }
83
84 > func ensureRepConfig(proto *persistencespb.NamespaceReplicationConfig) *persistencespb.NamespaceReplicationConfig { testconstructors.go
85 > if proto == nil {
86 > return &persistencespb.NamespaceReplicationConfig{} testconstructors.go
87 > }
88 > return proto testconstructors.go
89 }
go.temporal.io/server/api/historyservice/v1/request_response.pb.go 45 covered LOC · 1 range

Open complete file

11956 }
11957
11958 > func init() { file_temporal_server_api_historyservice_v1_request_response_proto_init() } request_response.pb.go
11959 > func file_temporal_server_api_historyservice_v1_request_response_proto_init() {
11960 > if File_temporal_server_api_historyservice_v1_request_response_proto != nil {
11961 > return
11962 > }
11963 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[107].OneofWrappers = []any{
11964 > (*StreamWorkflowReplicationMessagesRequest_SyncReplicationState)(nil),
11965 > }
11966 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[108].OneofWrappers = []any{
11967 > (*StreamWorkflowReplicationMessagesResponse_Messages)(nil),
11968 > }
11969 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[134].OneofWrappers = []any{
11970 > (*CompleteNexusOperationChasmRequest_Success)(nil),
11971 > (*CompleteNexusOperationChasmRequest_Failure)(nil),
11972 > }
11973 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[136].OneofWrappers = []any{
11974 > (*CompleteNexusOperationRequest_Success)(nil),
11975 > (*CompleteNexusOperationRequest_Failure)(nil),
11976 > }
11977 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[162].OneofWrappers = []any{
11978 > (*ExecuteMultiOperationRequest_Operation_StartWorkflow)(nil),
11979 > (*ExecuteMultiOperationRequest_Operation_UpdateWorkflow)(nil),
11980 > }
11981 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[163].OneofWrappers = []any{
11982 > (*ExecuteMultiOperationResponse_Response_StartWorkflow)(nil),
11983 > (*ExecuteMultiOperationResponse_Response_UpdateWorkflow)(nil),
11984 > }
11985 > type x struct{}
11986 > out := protoimpl.TypeBuilder{
11987 > File: protoimpl.DescBuilder{
11988 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
11989 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_historyservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_historyservice_v1_request_response_proto_rawDesc)),
11990 > NumEnums: 0,
11991 > NumMessages: 171,
11992 > NumExtensions: 1,
11993 > NumServices: 0,
11994 > },
11995 > GoTypes: file_temporal_server_api_historyservice_v1_request_response_proto_goTypes,
11996 > DependencyIndexes: file_temporal_server_api_historyservice_v1_request_response_proto_depIdxs,
11997 > MessageInfos: file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes,
11998 > ExtensionInfos: file_temporal_server_api_historyservice_v1_request_response_proto_extTypes,
11999 > }.Build()
12000 > File_temporal_server_api_historyservice_v1_request_response_proto = out.File
12001 > file_temporal_server_api_historyservice_v1_request_response_proto_goTypes = nil
12002 > file_temporal_server_api_historyservice_v1_request_response_proto_depIdxs = nil
12003 }
go.temporal.io/server/api/persistence/v1/nexus.pb.go 44 covered LOC · 10 ranges

Open complete file

71 }
72
73 > func (x *NexusEndpointSpec) GetName() string { nexus.pb.go
74 > if x != nil {
75 > return x.Name
76 > }
77 return ""
78 }
85 }
86
87 > func (x *NexusEndpointSpec) GetTarget() *NexusEndpointTarget { nexus.pb.go
88 > if x != nil {
89 > return x.Target nexus.pb.go
90 > }
91 return nil
92 }
136 }
137
138 > func (x *NexusEndpointTarget) GetVariant() isNexusEndpointTarget_Variant { nexus.pb.go
139 > if x != nil {
140 > return x.Variant
141 > }
142 return nil
143 }
232 }
233
234 > func (x *NexusEndpoint) GetSpec() *NexusEndpointSpec { nexus.pb.go
235 > if x != nil {
236 > return x.Spec nexus.pb.go
237 > }
238 return nil
239 }
300 }
301
302 > func (x *NexusEndpointEntry) GetEndpoint() *NexusEndpoint { nexus.pb.go
303 > if x != nil {
304 > return x.Endpoint nexus.pb.go
305 > }
306 return nil
307 }
481 }
482
483 > func init() { file_temporal_server_api_persistence_v1_nexus_proto_init() } nexus.pb.go
484 > func file_temporal_server_api_persistence_v1_nexus_proto_init() {
485 > if File_temporal_server_api_persistence_v1_nexus_proto != nil {
486 return
487 }
488 > file_temporal_server_api_persistence_v1_nexus_proto_msgTypes[1].OneofWrappers = []any{ nexus.pb.go
489 > (*NexusEndpointTarget_Worker_)(nil),
490 > (*NexusEndpointTarget_External_)(nil),
491 > }
492 > type x struct{}
493 > out := protoimpl.TypeBuilder{
494 > File: protoimpl.DescBuilder{
495 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
496 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_nexus_proto_rawDesc), len(file_temporal_server_api_persistence_v1_nexus_proto_rawDesc)),
497 > NumEnums: 0,
498 > NumMessages: 6,
499 > NumExtensions: 0,
500 > NumServices: 0,
501 > },
502 > GoTypes: file_temporal_server_api_persistence_v1_nexus_proto_goTypes,
503 > DependencyIndexes: file_temporal_server_api_persistence_v1_nexus_proto_depIdxs,
504 > MessageInfos: file_temporal_server_api_persistence_v1_nexus_proto_msgTypes,
505 > }.Build()
506 > File_temporal_server_api_persistence_v1_nexus_proto = out.File
507 > file_temporal_server_api_persistence_v1_nexus_proto_goTypes = nil
508 > file_temporal_server_api_persistence_v1_nexus_proto_depIdxs = nil
509 }
go.temporal.io/server/api/matchingservice/v1/request_response.pb.go 43 covered LOC · 1 range

Open complete file

6833 }
6834
6835 > func init() { file_temporal_server_api_matchingservice_v1_request_response_proto_init() } request_response.pb.go
6836 > func file_temporal_server_api_matchingservice_v1_request_response_proto_init() {
6837 > if File_temporal_server_api_matchingservice_v1_request_response_proto != nil {
6838 > return
6839 > }
6840 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[27].OneofWrappers = []any{
6841 > (*UpdateWorkerBuildIdCompatibilityRequest_ApplyPublicRequest_)(nil),
6842 > (*UpdateWorkerBuildIdCompatibilityRequest_RemoveBuildIds_)(nil),
6843 > (*UpdateWorkerBuildIdCompatibilityRequest_PersistUnknownBuildId)(nil),
6844 > }
6845 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[29].OneofWrappers = []any{
6846 > (*GetWorkerVersioningRulesRequest_Request)(nil),
6847 > }
6848 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[31].OneofWrappers = []any{
6849 > (*UpdateWorkerVersioningRulesRequest_Request)(nil),
6850 > }
6851 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[37].OneofWrappers = []any{
6852 > (*SyncDeploymentUserDataRequest_UpdateVersionData)(nil),
6853 > (*SyncDeploymentUserDataRequest_ForgetVersion)(nil),
6854 > }
6855 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[56].OneofWrappers = []any{
6856 > (*DispatchNexusTaskResponse_HandlerError)(nil),
6857 > (*DispatchNexusTaskResponse_Response)(nil),
6858 > (*DispatchNexusTaskResponse_RequestTimeout)(nil),
6859 > (*DispatchNexusTaskResponse_Failure)(nil),
6860 > }
6861 > type x struct{}
6862 > out := protoimpl.TypeBuilder{
6863 > File: protoimpl.DescBuilder{
6864 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
6865 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_matchingservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_matchingservice_v1_request_response_proto_rawDesc)),
6866 > NumEnums: 0,
6867 > NumMessages: 97,
6868 > NumExtensions: 0,
6869 > NumServices: 0,
6870 > },
6871 > GoTypes: file_temporal_server_api_matchingservice_v1_request_response_proto_goTypes,
6872 > DependencyIndexes: file_temporal_server_api_matchingservice_v1_request_response_proto_depIdxs,
6873 > MessageInfos: file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes,
6874 > }.Build()
6875 > File_temporal_server_api_matchingservice_v1_request_response_proto = out.File
6876 > file_temporal_server_api_matchingservice_v1_request_response_proto_goTypes = nil
6877 > file_temporal_server_api_matchingservice_v1_request_response_proto_depIdxs = nil
6878 }
go.temporal.io/server/api/token/v1/message.pb.go 42 covered LOC · 6 ranges

Open complete file

532 }
533
534 > func (x *HistoryEventRef) Reset() { message.pb.go
535 > *x = HistoryEventRef{}
536 > mi := &file_temporal_server_api_token_v1_message_proto_msgTypes[5]
537 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
538 > ms.StoreMessageInfo(mi)
539 > }
540
541 func (x *HistoryEventRef) String() string {
545 func (*HistoryEventRef) ProtoMessage() {}
546
547 > func (x *HistoryEventRef) ProtoReflect() protoreflect.Message { message.pb.go
548 > mi := &file_temporal_server_api_token_v1_message_proto_msgTypes[5]
549 > if x != nil {
550 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
551 > if ms.LoadMessageInfo() == nil {
552 > ms.StoreMessageInfo(mi)
553 > }
554 > return ms
555 }
556 return mi.MessageOf(x)
610 func (*NexusOperationCompletion) ProtoMessage() {}
611
612 > func (x *NexusOperationCompletion) ProtoReflect() protoreflect.Message { message.pb.go
613 > mi := &file_temporal_server_api_token_v1_message_proto_msgTypes[6]
614 > if x != nil {
615 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) message.pb.go
616 > if ms.LoadMessageInfo() == nil {
617 > ms.StoreMessageInfo(mi)
618 > }
619 > return ms
620 }
621 return mi.MessageOf(x)
785 }
786
787 > func init() { file_temporal_server_api_token_v1_message_proto_init() } message.pb.go
788 > func file_temporal_server_api_token_v1_message_proto_init() {
789 > if File_temporal_server_api_token_v1_message_proto != nil {
790 return
791 }
792 > type x struct{} message.pb.go
793 > out := protoimpl.TypeBuilder{
794 > File: protoimpl.DescBuilder{
795 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
796 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_token_v1_message_proto_rawDesc), len(file_temporal_server_api_token_v1_message_proto_rawDesc)),
797 > NumEnums: 0,
798 > NumMessages: 7,
799 > NumExtensions: 0,
800 > NumServices: 0,
801 > },
802 > GoTypes: file_temporal_server_api_token_v1_message_proto_goTypes,
803 > DependencyIndexes: file_temporal_server_api_token_v1_message_proto_depIdxs,
804 > MessageInfos: file_temporal_server_api_token_v1_message_proto_msgTypes,
805 > }.Build()
806 > File_temporal_server_api_token_v1_message_proto = out.File
807 > file_temporal_server_api_token_v1_message_proto_goTypes = nil
808 > file_temporal_server_api_token_v1_message_proto_depIdxs = nil
809 }
go.temporal.io/server/common/metrics/defs.go 41 covered LOC · 7 ranges

Open complete file

20 )
21
22 > func NewTimerDef(name string, opts ...Option) timerDefinition { defs.go
23 > // This line cannot be combined with others!
24 > // This ensures the stack trace has information of the caller.
25 > def := newMetricDefinition(name, opts...)
26 > globalRegistry.register(def)
27 > return timerDefinition{def}
28 > }
29
30 > func NewBytesHistogramDef(name string, opts ...Option) histogramDefinition { defs.go
31 > // This line cannot be combined with others!
32 > // This ensures the stack trace has information of the caller.
33 > def := newMetricDefinition(name, append(opts, WithUnit(Bytes))...)
34 > globalRegistry.register(def)
35 > return histogramDefinition{def}
36 > }
37
38 > func NewDimensionlessHistogramDef(name string, opts ...Option) histogramDefinition { defs.go
39 > // This line cannot be combined with others!
40 > // This ensures the stack trace has information of the caller.
41 > def := newMetricDefinition(name, append(opts, WithUnit(Dimensionless))...)
42 > globalRegistry.register(def)
43 > return histogramDefinition{def}
44 > }
45
46 > func NewCounterDef(name string, opts ...Option) counterDefinition { defs.go
47 > // This line cannot be combined with others!
48 > // This ensures the stack trace has information of the caller.
49 > def := newMetricDefinition(name, opts...)
50 > globalRegistry.register(def)
51 > return counterDefinition{def}
52 > }
53
54 > func NewGaugeDef(name string, opts ...Option) gaugeDefinition { defs.go
55 > // This line cannot be combined with others!
56 > // This ensures the stack trace has information of the caller.
57 > def := newMetricDefinition(name, opts...)
58 > globalRegistry.register(def)
59 > return gaugeDefinition{def}
60 > }
61
62 func (d histogramDefinition) With(handler Handler) HistogramIface {
64 }
65
66 > func (d counterDefinition) With(handler Handler) CounterIface { defs.go
67 > return handler.Counter(d.name)
68 > }
69
70 func (d gaugeDefinition) With(handler Handler) GaugeIface {
72 }
73
74 > func (d timerDefinition) With(handler Handler) TimerIface { defs.go
75 > return handler.Timer(d.name)
76 > }
go.temporal.io/server/api/persistence/v1/chasm.pb.go 37 covered LOC · 3 ranges

Open complete file

571 func (*ChasmTaskInfo) ProtoMessage() {}
572
573 > func (x *ChasmTaskInfo) ProtoReflect() protoreflect.Message { chasm.pb.go
574 > mi := &file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[8]
575 > if x != nil {
576 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
577 if ms.LoadMessageInfo() == nil {
580 return ms
581 }
582 > return mi.MessageOf(x) chasm.pb.go
583 }
584
1180 }
1181
1182 > func init() { file_temporal_server_api_persistence_v1_chasm_proto_init() } chasm.pb.go
1183 > func file_temporal_server_api_persistence_v1_chasm_proto_init() {
1184 > if File_temporal_server_api_persistence_v1_chasm_proto != nil {
1185 > return
1186 > }
1187 > file_temporal_server_api_persistence_v1_hsm_proto_init()
1188 > file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[1].OneofWrappers = []any{
1189 > (*ChasmNodeMetadata_ComponentAttributes)(nil),
1190 > (*ChasmNodeMetadata_DataAttributes)(nil),
1191 > (*ChasmNodeMetadata_CollectionAttributes)(nil),
1192 > (*ChasmNodeMetadata_PointerAttributes)(nil),
1193 > }
1194 > file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[10].OneofWrappers = []any{
1195 > (*ChasmNexusCompletion_Success)(nil),
1196 > (*ChasmNexusCompletion_Failure)(nil),
1197 > }
1198 > type x struct{}
1199 > out := protoimpl.TypeBuilder{
1200 > File: protoimpl.DescBuilder{
1201 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1202 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_chasm_proto_rawDesc), len(file_temporal_server_api_persistence_v1_chasm_proto_rawDesc)),
1203 > NumEnums: 0,
1204 > NumMessages: 15,
1205 > NumExtensions: 0,
1206 > NumServices: 0,
1207 > },
1208 > GoTypes: file_temporal_server_api_persistence_v1_chasm_proto_goTypes,
1209 > DependencyIndexes: file_temporal_server_api_persistence_v1_chasm_proto_depIdxs,
1210 > MessageInfos: file_temporal_server_api_persistence_v1_chasm_proto_msgTypes,
1211 > }.Build()
1212 > File_temporal_server_api_persistence_v1_chasm_proto = out.File
1213 > file_temporal_server_api_persistence_v1_chasm_proto_goTypes = nil
1214 > file_temporal_server_api_persistence_v1_chasm_proto_depIdxs = nil
1215 }
go.temporal.io/server/api/adminservice/v1/request_response.pb.go 36 covered LOC · 1 range

Open complete file

6623 }
6624
6625 > func init() { file_temporal_server_api_adminservice_v1_request_response_proto_init() } request_response.pb.go
6626 > func file_temporal_server_api_adminservice_v1_request_response_proto_init() {
6627 > if File_temporal_server_api_adminservice_v1_request_response_proto != nil {
6628 > return
6629 > }
6630 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[59].OneofWrappers = []any{
6631 > (*StreamWorkflowReplicationMessagesRequest_SyncReplicationState)(nil),
6632 > }
6633 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[60].OneofWrappers = []any{
6634 > (*StreamWorkflowReplicationMessagesResponse_Messages)(nil),
6635 > }
6636 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[61].OneofWrappers = []any{
6637 > (*GetNamespaceRequest_Namespace)(nil),
6638 > (*GetNamespaceRequest_Id)(nil),
6639 > }
6640 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[90].OneofWrappers = []any{
6641 > (*StartAdminBatchOperationRequest_RefreshTasksOperation)(nil),
6642 > }
6643 > type x struct{}
6644 > out := protoimpl.TypeBuilder{
6645 > File: protoimpl.DescBuilder{
6646 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
6647 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_adminservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_adminservice_v1_request_response_proto_rawDesc)),
6648 > NumEnums: 1,
6649 > NumMessages: 105,
6650 > NumExtensions: 0,
6651 > NumServices: 0,
6652 > },
6653 > GoTypes: file_temporal_server_api_adminservice_v1_request_response_proto_goTypes,
6654 > DependencyIndexes: file_temporal_server_api_adminservice_v1_request_response_proto_depIdxs,
6655 > EnumInfos: file_temporal_server_api_adminservice_v1_request_response_proto_enumTypes,
6656 > MessageInfos: file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes,
6657 > }.Build()
6658 > File_temporal_server_api_adminservice_v1_request_response_proto = out.File
6659 > file_temporal_server_api_adminservice_v1_request_response_proto_goTypes = nil
6660 > file_temporal_server_api_adminservice_v1_request_response_proto_depIdxs = nil
6661 }
go.temporal.io/server/api/replication/v1/message.pb.go 36 covered LOC · 2 ranges

Open complete file

2441 }
2442
2443 > func init() { file_temporal_server_api_replication_v1_message_proto_init() } message.pb.go
2444 > func file_temporal_server_api_replication_v1_message_proto_init() {
2445 > if File_temporal_server_api_replication_v1_message_proto != nil {
2446 return
2447 }
2448 > file_temporal_server_api_replication_v1_message_proto_msgTypes[0].OneofWrappers = []any{ message.pb.go
2449 > (*ReplicationTask_NamespaceTaskAttributes)(nil),
2450 > (*ReplicationTask_SyncShardStatusTaskAttributes)(nil),
2451 > (*ReplicationTask_SyncActivityTaskAttributes)(nil),
2452 > (*ReplicationTask_HistoryTaskAttributes)(nil),
2453 > (*ReplicationTask_SyncWorkflowStateTaskAttributes)(nil),
2454 > (*ReplicationTask_TaskQueueUserDataAttributes)(nil),
2455 > (*ReplicationTask_SyncHsmAttributes)(nil),
2456 > (*ReplicationTask_BackfillHistoryTaskAttributes)(nil),
2457 > (*ReplicationTask_VerifyVersionedTransitionTaskAttributes)(nil),
2458 > (*ReplicationTask_SyncVersionedTransitionTaskAttributes)(nil),
2459 > }
2460 > file_temporal_server_api_replication_v1_message_proto_msgTypes[21].OneofWrappers = []any{
2461 > (*VersionedTransitionArtifact_SyncWorkflowStateMutationAttributes)(nil),
2462 > (*VersionedTransitionArtifact_SyncWorkflowStateSnapshotAttributes)(nil),
2463 > }
2464 > type x struct{}
2465 > out := protoimpl.TypeBuilder{
2466 > File: protoimpl.DescBuilder{
2467 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
2468 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_replication_v1_message_proto_rawDesc), len(file_temporal_server_api_replication_v1_message_proto_rawDesc)),
2469 > NumEnums: 0,
2470 > NumMessages: 23,
2471 > NumExtensions: 0,
2472 > NumServices: 0,
2473 > },
2474 > GoTypes: file_temporal_server_api_replication_v1_message_proto_goTypes,
2475 > DependencyIndexes: file_temporal_server_api_replication_v1_message_proto_depIdxs,
2476 > MessageInfos: file_temporal_server_api_replication_v1_message_proto_msgTypes,
2477 > }.Build()
2478 > File_temporal_server_api_replication_v1_message_proto = out.File
2479 > file_temporal_server_api_replication_v1_message_proto_goTypes = nil
2480 > file_temporal_server_api_replication_v1_message_proto_depIdxs = nil
2481 }
go.temporal.io/server/api/persistence/v1/update.pb.go 35 covered LOC · 3 ranges

Open complete file

222 func (*UpdateInfo) ProtoMessage() {}
223
224 > func (x *UpdateInfo) ProtoReflect() protoreflect.Message { update.pb.go
225 > mi := &file_temporal_server_api_persistence_v1_update_proto_msgTypes[3]
226 > if x != nil {
227 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
228 if ms.LoadMessageInfo() == nil {
231 return ms
232 }
233 > return mi.MessageOf(x) update.pb.go
234 }
235
422 }
423
424 > func init() { file_temporal_server_api_persistence_v1_update_proto_init() } update.pb.go
425 > func file_temporal_server_api_persistence_v1_update_proto_init() {
426 > if File_temporal_server_api_persistence_v1_update_proto != nil {
427 > return
428 > }
429 > file_temporal_server_api_persistence_v1_hsm_proto_init()
430 > file_temporal_server_api_persistence_v1_update_proto_msgTypes[0].OneofWrappers = []any{
431 > (*UpdateAdmissionInfo_HistoryPointer_)(nil),
432 > }
433 > file_temporal_server_api_persistence_v1_update_proto_msgTypes[3].OneofWrappers = []any{
434 > (*UpdateInfo_Acceptance)(nil),
435 > (*UpdateInfo_Completion)(nil),
436 > (*UpdateInfo_Admission)(nil),
437 > }
438 > type x struct{}
439 > out := protoimpl.TypeBuilder{
440 > File: protoimpl.DescBuilder{
441 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
442 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_update_proto_rawDesc), len(file_temporal_server_api_persistence_v1_update_proto_rawDesc)),
443 > NumEnums: 0,
444 > NumMessages: 5,
445 > NumExtensions: 0,
446 > NumServices: 0,
447 > },
448 > GoTypes: file_temporal_server_api_persistence_v1_update_proto_goTypes,
449 > DependencyIndexes: file_temporal_server_api_persistence_v1_update_proto_depIdxs,
450 > MessageInfos: file_temporal_server_api_persistence_v1_update_proto_msgTypes,
451 > }.Build()
452 > File_temporal_server_api_persistence_v1_update_proto = out.File
453 > file_temporal_server_api_persistence_v1_update_proto_goTypes = nil
454 > file_temporal_server_api_persistence_v1_update_proto_depIdxs = nil
455 }
go.temporal.io/server/common/backoff/retrypolicy.go 34 covered LOC · 6 ranges

Open complete file

80
81 // NewExponentialRetryPolicy returns an instance of ExponentialRetryPolicy using the provided initialInterval
82 > func NewExponentialRetryPolicy(initialInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
83 > p := &ExponentialRetryPolicy{
84 > initialInterval: initialInterval,
85 > backoffCoefficient: defaultBackoffCoefficient,
86 > maximumInterval: defaultMaximumInterval,
87 > expirationInterval: defaultExpirationInterval,
88 > maximumAttempts: defaultMaximumAttempts,
89 > }
90 >
91 > return p
92 > }
93
94 // NewRetrier is used for creating a new instance of Retrier
121 // This does *not* cause the policy to stop retrying when the interval between retries reaches the supplied duration.
122 // That is what WithExpirationInterval does. Instead, this prevents the interval from exceeding maximumInterval.
123 > func (p *ExponentialRetryPolicy) WithMaximumInterval(maximumInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
124 > p.maximumInterval = maximumInterval
125 > return p
126 > }
127
128 // WithExpirationInterval sets the absolute expiration interval for all retries
129 > func (p *ExponentialRetryPolicy) WithExpirationInterval(expirationInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
130 > p.expirationInterval = expirationInterval
131 > return p
132 > }
133
134 // WithMaximumAttempts sets the maximum number of retry attempts
135 > func (p *ExponentialRetryPolicy) WithMaximumAttempts(maximumAttempts int) *ExponentialRetryPolicy { retrypolicy.go
136 > p.maximumAttempts = maximumAttempts
137 > return p
138 > }
139
140 // ComputeNextDelay returns the next delay interval. This is used by Retrier to delay calling the operation again
267 var _ RetryPolicy = (*ConstantDelayRetryPolicy)(nil)
268
269 > func NewConstantDelayRetryPolicy(delay time.Duration) *ConstantDelayRetryPolicy { retrypolicy.go
270 > return &ConstantDelayRetryPolicy{
271 > maximumAttempts: defaultMaximumAttempts,
272 > jitterPct: defaultJitterPct,
273 > delay: delay,
274 > }
275 > }
276
277 > func (p *ConstantDelayRetryPolicy) WithMaximumAttempts(maximumAttempts int) *ConstantDelayRetryPolicy { retrypolicy.go
278 > p.maximumAttempts = maximumAttempts
279 > return p
280 > }
281
282 func (p *ConstantDelayRetryPolicy) WithJitter(jitterPct float64) *ConstantDelayRetryPolicy {
go.temporal.io/server/common/log/tag/tags.go 33 covered LOC · 10 ranges

Open complete file

35
36 // Error returns tag for Error
37 > func Error(err error) ZapTag { tags.go
38 > return ZapTag{
39 > // NOTE: zap already chosen "error" as key
40 > field: zap.Error(err),
41 > }
42 > }
43
44 // ServiceErrorType returns tag for ServiceErrorType
70
71 // WorkflowAction returns tag for WorkflowAction
72 > func workflowAction(action string) ZapTag { tags.go
73 > return NewStringTag("wf-action", action)
74 > }
75
76 // WorkflowListFilterType returns tag for WorkflowListFilterType
77 > func workflowListFilterType(listFilterType string) ZapTag { tags.go
78 > return NewStringTag("wf-list-filter-type", listFilterType)
79 > }
80
81 // general
376
377 // Component returns tag for Component
378 > func component(component string) ZapTag { tags.go
379 > return NewStringTag("component", component)
380 > }
381
382 // Lifecycle returns tag for Lifecycle
383 > func lifecycle(lifecycle string) ZapTag { tags.go
384 > return NewStringTag("lifecycle", lifecycle)
385 > }
386
387 // StoreOperation returns tag for StoreOperation
388 > func storeOperation(storeOperation string) ZapTag { tags.go
389 > return NewStringTag("store-operation", storeOperation)
390 > }
391
392 // OperationResult returns tag for OperationResult
393 > func operationResult(operationResult string) ZapTag { tags.go
394 > return NewStringTag("operation-result", operationResult)
395 > }
396
397 // ErrorType returns tag for ErrorType
401
402 // errorType returns tag for ErrorType given a string
403 > func errorType(errorType string) ZapTag { tags.go
404 > return NewStringTag("error-type", errorType)
405 > }
406
407 // Shardupdate returns tag for Shardupdate
408 > func shardupdate(shardupdate string) ZapTag { tags.go
409 > return NewStringTag("shard-update", shardupdate)
410 > }
411
412 // scope returns a tag for scope
413 // Pre-defined scope tags are in values.go.
414 > func scope(scope string) ZapTag { tags.go
415 > return NewStringTag("scope", scope)
416 > }
417
418 // general
go.temporal.io/server/common/testing/freeport/freeport.go 33 covered LOC · 7 ranges

Open complete file

22 // in this regard; on that platform, `SO_REUSEADDR` has a different meaning and
23 // should not be set (setting it may have unpredictable consequences).
24 > func MustGetFreePort() int { freeport.go
25 > port, err := getFreePort("127.0.0.1")
26 > if err != nil {
27 // try ipv6
28 port, err = getFreePort("[::1]")
31 }
32 }
33 > return port freeport.go
34 }
35
36 > func getFreePort(host string) (int, error) { freeport.go
37 > l, err := net.Listen("tcp", host+":0")
38 > if err != nil {
39 return 0, fmt.Errorf("failed to assign a free port: %v", err)
40 }
41 > defer l.Close() freeport.go
42 > port := l.Addr().(*net.TCPAddr).Port
43 >
44 > // On Linux and some BSD variants, ephemeral ports are randomized, and may
45 > // consequently repeat within a short time frame after the listening end
46 > // has been closed. To avoid this, we make a connection to the port, then
47 > // close that connection from the server's side (this is very important),
48 > // which puts the connection in TIME_WAIT state for some time (by default,
49 > // 60s on Linux). While it remains in that state, the OS will not reallocate
50 > // that port number for bind(:0) syscalls, yet we are not prevented from
51 > // explicitly binding to it (thanks to SO_REUSEADDR).
52 > //
53 > // On macOS and Windows, the above technique is not necessary, as the OS
54 > // allocates ephemeral ports sequentially, meaning a port number will only
55 > // be reused after the entire range has been exhausted. Quite the opposite,
56 > // given that these OSes use a significantly smaller range for ephemeral
57 > // ports, making an extra connection just to reserve a port might actually
58 > // be harmful (by hastening ephemeral port exhaustion).
59 > if runtime.GOOS != "darwin" && runtime.GOOS != "windows" {
60 > r, err := net.DialTCP("tcp", nil, l.Addr().(*net.TCPAddr))
61 > if err != nil {
62 return 0, fmt.Errorf("failed to assign a free port: %v", err)
63 }
64 > c, err := l.Accept() freeport.go
65 > if err != nil {
66 return 0, fmt.Errorf("failed to assign a free port: %v", err)
67 }
68 // Closing the socket from the server side
69 > _ = c.Close() freeport.go
70 > defer r.Close()
71 }
72
73 > return port, nil freeport.go
74 }
go.temporal.io/server/service/history/hsm/hsmtest/backend.go 33 covered LOC · 10 ranges

Open complete file

20 }
21
22 > func (n *NodeBackend) GetCurrentVersion() int64 { backend.go
23 > return 1
24 > }
25
26 > func (n *NodeBackend) NextTransitionCount() int64 { backend.go
27 > return 3
28 > }
29
30 > func (n *NodeBackend) GetWorkflowType() *commonpb.WorkflowType { backend.go
31 > return &commonpb.WorkflowType{Name: "workflow-type"}
32 > }
33
34 > func (n *NodeBackend) GetNamespaceEntry() *namespace.Namespace { backend.go
35 > return namespace.NewNamespaceForTest(&persistencespb.NamespaceInfo{Name: "namespace-name"}, nil, false, nil, 0)
36 > }
37
38 > func (n *NodeBackend) AddHistoryEvent(t enumspb.EventType, setAttributes func(*historypb.HistoryEvent)) *historypb.HistoryEvent { backend.go
39 > event := &historypb.HistoryEvent{EventType: t, EventId: 2}
40 > setAttributes(event)
41 > n.Events = append(n.Events, event)
42 > return event
43 > }
44
45 > func (n *NodeBackend) GenerateEventLoadToken(event *historypb.HistoryEvent) ([]byte, error) { backend.go
46 > token := &tokenspb.HistoryEventRef{
47 > EventId: event.EventId,
48 > EventBatchId: event.EventId,
49 > }
50 > return proto.Marshal(token)
51 > }
52
53 > func (n *NodeBackend) LoadHistoryEvent(ctx context.Context, tokenBytes []byte) (*historypb.HistoryEvent, error) { backend.go
54 > var token tokenspb.HistoryEventRef
55 > if err := proto.Unmarshal(tokenBytes, &token); err != nil {
56 return nil, err
57 }
58 > idx := slices.IndexFunc(n.Events, func(event *historypb.HistoryEvent) bool { backend.go
59 > return event.EventId == token.EventId
60 > })
61
62 > if idx < 0 { backend.go
63 return nil, fmt.Errorf("event not found")
64 }
65
66 > return n.Events[idx], nil backend.go
67 }
68
go.temporal.io/server/common/nexus/nexustest/server.go 32 covered LOC · 5 ranges

Open complete file

15 )
16
17 > func AllocListenAddress() string { server.go
18 > return fmt.Sprintf("localhost:%d", freeport.MustGetFreePort())
19 > }
20
21 > func NewNexusServer(t *testing.T, listenAddr string, handler nexus.Handler) { server.go
22 > // Create listener
23 > listener, err := net.Listen("tcp", listenAddr)
24 > require.NoError(t, err, "Nexus test server failed to listen on %s", listenAddr)
25 >
26 > // Create HTTP handler and server
27 > hh := nexusrpc.NewHTTPHandler(nexusrpc.HandlerOptions{
28 > Handler: handler,
29 > })
30 > srv := &http.Server{Addr: listenAddr, Handler: hh}
31 >
32 > // Start server
33 > errCh := make(chan error, 1)
34 > go func() {
35 > errCh <- srv.Serve(listener)
36 > }()
37
38 > t.Cleanup(func() { server.go
39 > ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
40 > defer cancel()
41 >
42 > // Shutdown server gracefully
43 > err = srv.Shutdown(ctx)
44 > if err != nil {
45 // Graceful shutdown failed, force close
46 require.ErrorIs(t, err, context.DeadlineExceeded, "Nexus test server graceful shutdown failed")
49
50 // Wait for server to exit gracefully
51 > select { server.go
52 > case err := <-errCh:
53 > require.ErrorIs(t, err, http.ErrServerClosed, "Nexus test server Serve returned unexpected error")
54 case <-time.After(time.Second):
55 require.Fail(t, "Nexus test server Serve did not exit after shutdown")
64 }
65
66 > func (h Handler) StartOperation(ctx context.Context, service, operation string, input *nexus.LazyValue, options nexus.StartOperationOptions) (nexus.HandlerStartOperationResult[any], error) { server.go
67 > return h.OnStartOperation(ctx, service, operation, input, options)
68 > }
69
70 func (h Handler) CancelOperation(ctx context.Context, service, operation, token string, options nexus.CancelOperationOptions) error {
go.temporal.io/server/common/dynamicconfig/deepcopy.go 31 covered LOC · 6 ranges

Open complete file

9 // deepCopyForMapstructure does a simple deep copy of T. Fancy cases (anything other than plain old data)
10 // is not handled and will panic.
11 > func deepCopyForMapstructure[T any](t T) T { deepcopy.go
12 > // nolint:revive // this will be triggered from a static initializer before it can be triggered from production code
13 > return deepCopyValue(reflect.ValueOf(t)).Interface().(T)
14 > }
15
16 > func deepCopyValue(v reflect.Value) reflect.Value { deepcopy.go
17 > switch v.Kind() {
18 case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
19 reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
20 > reflect.Uintptr, reflect.Float32, reflect.Float64, reflect.String: deepcopy.go
21 > nv := reflect.New(v.Type()).Elem()
22 > nv.Set(v)
23 > return nv
24 case reflect.Array:
25 nv := reflect.New(v.Type()).Elem()
42 }
43 return deepCopyValue(v.Elem()).Addr()
44 > case reflect.Slice: deepcopy.go
45 > if v.IsNil() {
46 > return v
47 > }
48 nv := reflect.MakeSlice(v.Type(), v.Len(), v.Len())
49 for i := range v.Len() {
51 }
52 return nv
53 > case reflect.Struct: deepcopy.go
54 > // Special case for time.Time: it has unexported fields so we can't copy it field by
55 > // field, but we can copy zero values (which is all we need for default values).
56 > if v.Type() == reflect.TypeFor[time.Time]() {
57 > if v.Interface().(time.Time).IsZero() {
58 > return reflect.ValueOf(time.Time{})
59 > }
60 // nolint:forbidigo // this will be triggered from a static initializer before it can be triggered from production code
61 panic(fmt.Sprintf("Can't deep copy non-zero time.Time: %v", v.Interface()))
62 }
63 > nv := reflect.New(v.Type()).Elem() deepcopy.go
64 > for i := range v.Type().NumField() {
65 > nv.Field(i).Set(deepCopyValue(v.Field(i)))
66 > }
67 > return nv
68 > case reflect.Interface, reflect.Func, reflect.Chan:
69 > // only nil values of any other reference types allowed!
70 > if v.IsNil() {
71 > return v
72 > }
73 fallthrough
74 default:
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/execution_maps.go 30 covered LOC · 5 ranges

Open complete file

53 )
54
55 > func stringMap(a []string, f func(string) string) []string { execution_maps.go
56 > b := make([]string, len(a))
57 > for i, v := range a {
58 > b[i] = f(v)
59 > }
60 > return b
61 }
62
63 > func makeDeleteMapQry(tableName string) string { execution_maps.go
64 > return fmt.Sprintf(deleteMapQryTemplate, tableName)
65 > }
66
67 > func makeSetKeyInMapQry(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
68 > return fmt.Sprintf(setKeyInMapQryTemplate,
69 > tableName,
70 > strings.Join(nonPrimaryKeyColumns, ","),
71 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
72 > return ":" + x
73 > }), ","),
74 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
75 > return x + "=VALUES(" + x + ")"
76 > }), ","),
77 mapKeyName)
78 }
79
80 > func makeDeleteKeyInMapQry(tableName string, mapKeyName string) string { execution_maps.go
81 > return fmt.Sprintf(deleteKeyInMapQryTemplate,
82 > tableName,
83 > mapKeyName)
84 > }
85
86 > func makeGetMapQryTemplate(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
87 > return fmt.Sprintf(getMapQryTemplate,
88 > tableName,
89 > mapKeyName,
90 > strings.Join(nonPrimaryKeyColumns, ","))
91 > }
92
93 var (
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/execution_maps.go 30 covered LOC · 6 ranges

Open complete file

86 )
87
88 > func stringMap(a []string, f func(string) string) []string { execution_maps.go
89 > b := make([]string, len(a))
90 > for i, v := range a {
91 > b[i] = f(v)
92 > }
93 > return b
94 }
95
96 > func makeDeleteMapQry(tableName string) string { execution_maps.go
97 > return fmt.Sprintf(deleteMapQueryTemplate, tableName)
98 > }
99
100 > func makeSetKeyInMapQry(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
101 > return fmt.Sprintf(setKeyInMapQueryTemplate,
102 > tableName,
103 > strings.Join(nonPrimaryKeyColumns, ","),
104 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
105 > return ":" + x
106 > }), ","),
107 mapKeyName,
108 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string { execution_maps.go
109 > return "excluded." + x
110 > }), ","))
111 }
112
113 > func makeDeleteKeyInMapQry(tableName string, mapKeyName string) string { execution_maps.go
114 > return fmt.Sprintf(deleteKeyInMapQueryTemplate,
115 > tableName,
116 > mapKeyName)
117 > }
118
119 > func makeGetMapQryTemplate(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
120 > return fmt.Sprintf(getMapQueryTemplate,
121 > tableName,
122 > mapKeyName,
123 > strings.Join(nonPrimaryKeyColumns, ","))
124 > }
125
126 var (
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/execution_maps.go 30 covered LOC · 5 ranges

Open complete file

52 )
53
54 > func stringMap(a []string, f func(string) string) []string { execution_maps.go
55 > b := make([]string, len(a))
56 > for i, v := range a {
57 > b[i] = f(v)
58 > }
59 > return b
60 }
61
62 > func makeDeleteMapQry(tableName string) string { execution_maps.go
63 > return fmt.Sprintf(deleteMapQryTemplate, tableName)
64 > }
65
66 > func makeSetKeyInMapQry(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
67 > return fmt.Sprintf(setKeyInMapQryTemplate,
68 > tableName,
69 > strings.Join(nonPrimaryKeyColumns, ","),
70 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
71 > return ":" + x
72 > }), ","),
73 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
74 > return x + "=" + x
75 > }), ","),
76 mapKeyName)
77 }
78
79 > func makeDeleteKeyInMapQry(tableName string, mapKeyName string) string { execution_maps.go
80 > return fmt.Sprintf(deleteKeyInMapQryTemplate,
81 > tableName,
82 > mapKeyName)
83 > }
84
85 > func makeGetMapQryTemplate(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
86 > return fmt.Sprintf(getMapQryTemplate,
87 > tableName,
88 > mapKeyName,
89 > strings.Join(nonPrimaryKeyColumns, ","))
90 > }
91
92 var (
go.temporal.io/server/common/searchattribute/sadefs/constants.go 30 covered LOC · 9 ranges

Open complete file

261 }
262
263 > dbCustomSearchAttributeFieldNameRE = func() map[enumspb.IndexedValueType]*regexp.Regexp { constants.go
264 > res := map[enumspb.IndexedValueType]*regexp.Regexp{}
265 > for t := range defaultNumDBCustomSearchAttributes {
266 > res[t] = regexp.MustCompile(fmt.Sprintf(`^%s(0[1-9]|[1-9][0-9])$`, t.String()))
267 > }
268 > return res
269 }()
270 )
271
272 // System returns a clone of the system search attributes map.
273 > func System() map[string]enumspb.IndexedValueType { constants.go
274 > return maps.Clone(system)
275 > }
276
277 // Predefined returns a clone of the predefined search attributes map.
278 > func Predefined() map[string]enumspb.IndexedValueType { constants.go
279 > return maps.Clone(predefined)
280 > }
281
282 // PredefinedWhiteList returns a clone of the predefined whitelist search attributes map.
283 > func PredefinedWhiteList() map[string]enumspb.IndexedValueType { constants.go
284 > return maps.Clone(predefinedWhiteList)
285 > }
286
287 // Reserved returns a clone of the reserved field names map.
343 // GetSqlDbColName maps system and reserved search attributes to column names for SQL tables.
344 // If the input is not a system or reserved search attribute, then it returns the input.
345 > func GetSqlDbColName(name string) string { constants.go
346 > if fieldName, ok := sqlDbSystemNameToColName[name]; ok {
347 > return fieldName constants.go
348 > }
349 return name
350 }
352 func GetDBIndexSearchAttributes(
353 override map[enumspb.IndexedValueType]int,
354 > ) *persistencespb.IndexSearchAttributes { constants.go
355 > csa := map[string]enumspb.IndexedValueType{}
356 > for saType, defaultNumAttrs := range defaultNumDBCustomSearchAttributes {
357 > numAttrs := defaultNumAttrs
358 > if value, ok := override[saType]; ok {
359 numAttrs = value
360 }
361 > for i := range numAttrs { constants.go
362 > csa[fmt.Sprintf("%s%02d", saType.String(), i+1)] = saType
363 > }
364 }
365 > return &persistencespb.IndexSearchAttributes{ constants.go
366 > CustomSearchAttributes: csa,
367 > }
368 }
369
go.temporal.io/server/api/taskqueue/v1/message.pb.go 29 covered LOC · 2 ranges

Open complete file

1330 }
1331
1332 > func init() { file_temporal_server_api_taskqueue_v1_message_proto_init() } message.pb.go
1333 > func file_temporal_server_api_taskqueue_v1_message_proto_init() {
1334 > if File_temporal_server_api_taskqueue_v1_message_proto != nil {
1335 return
1336 }
1337 > file_temporal_server_api_taskqueue_v1_message_proto_msgTypes[0].OneofWrappers = []any{ message.pb.go
1338 > (*TaskVersionDirective_UseAssignmentRules)(nil),
1339 > (*TaskVersionDirective_AssignedBuildId)(nil),
1340 > }
1341 > file_temporal_server_api_taskqueue_v1_message_proto_msgTypes[5].OneofWrappers = []any{
1342 > (*TaskQueuePartition_NormalPartitionId)(nil),
1343 > (*TaskQueuePartition_StickyName)(nil),
1344 > (*TaskQueuePartition_WorkerCommands)(nil),
1345 > }
1346 > type x struct{}
1347 > out := protoimpl.TypeBuilder{
1348 > File: protoimpl.DescBuilder{
1349 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1350 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_taskqueue_v1_message_proto_rawDesc), len(file_temporal_server_api_taskqueue_v1_message_proto_rawDesc)),
1351 > NumEnums: 0,
1352 > NumMessages: 16,
1353 > NumExtensions: 0,
1354 > NumServices: 0,
1355 > },
1356 > GoTypes: file_temporal_server_api_taskqueue_v1_message_proto_goTypes,
1357 > DependencyIndexes: file_temporal_server_api_taskqueue_v1_message_proto_depIdxs,
1358 > MessageInfos: file_temporal_server_api_taskqueue_v1_message_proto_msgTypes,
1359 > }.Build()
1360 > File_temporal_server_api_taskqueue_v1_message_proto = out.File
1361 > file_temporal_server_api_taskqueue_v1_message_proto_goTypes = nil
1362 > file_temporal_server_api_taskqueue_v1_message_proto_depIdxs = nil
1363 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/operation.pb.go 29 covered LOC · 4 ranges

Open complete file

87 }
88
89 > func (x OperationStatus) String() string { operation.pb.go
90 > switch x {
91 case OPERATION_STATUS_UNSPECIFIED:
92 return "Unspecified"
99 case OPERATION_STATUS_SUCCEEDED:
100 return "Succeeded"
101 > case OPERATION_STATUS_FAILED: operation.pb.go
102 > return "Failed"
103 case OPERATION_STATUS_CANCELED:
104 return "Canceled"
998 }
999
1000 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_init() } operation.pb.go
1001 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_init() {
1002 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto != nil {
1003 return
1004 }
1005 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_msgTypes[2].OneofWrappers = []any{ operation.pb.go
1006 > (*OperationOutcome_Successful_)(nil),
1007 > (*OperationOutcome_Failed_)(nil),
1008 > }
1009 > type x struct{}
1010 > out := protoimpl.TypeBuilder{
1011 > File: protoimpl.DescBuilder{
1012 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1013 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_rawDesc)),
1014 > NumEnums: 2,
1015 > NumMessages: 8,
1016 > NumExtensions: 0,
1017 > NumServices: 0,
1018 > },
1019 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_goTypes,
1020 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_depIdxs,
1021 > EnumInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_enumTypes,
1022 > MessageInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_msgTypes,
1023 > }.Build()
1024 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto = out.File
1025 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_goTypes = nil
1026 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_depIdxs = nil
1027 }
go.temporal.io/server/common/namespace/namespace.go 29 covered LOC · 10 ranges

Open complete file

81 resolver ReplicationResolver,
82 mutations ...Mutation,
83 > ) (*Namespace, error) { namespace.go
84 > if resolver == nil {
85 return nil, serviceerror.NewInvalidArgument("replicationResolver must be provided")
86 }
87 > ns := &Namespace{ namespace.go
88 > info: detail.Info,
89 > config: detail.Config,
90 > configVersion: detail.ConfigVersion,
91 > customSearchAttributesMapper: CustomSearchAttributesMapper{
92 > fieldToAlias: detail.Config.CustomSearchAttributeAliases,
93 > aliasToField: util.InverseMap(detail.Config.CustomSearchAttributeAliases),
94 > },
95 > replicationResolver: resolver,
96 > }
97 >
98 > for _, m := range mutations {
99 > m.apply(ns) namespace.go
100 > }
101
102 > return ns, nil namespace.go
103 }
104
159
160 // ID observes this namespace's permanent unique identifier in string form.
161 > func (ns *Namespace) ID() ID { namespace.go
162 > if ns.info == nil {
163 return ID("")
164 }
165 > return ID(ns.info.Id) namespace.go
166 }
167
168 // Name observes this namespace's configured name.
169 > func (ns *Namespace) Name() Name { namespace.go
170 > if ns.info == nil {
171 return Name("")
172 }
173 > return Name(ns.info.Name) namespace.go
174 }
175
337 }
338
339 > func (id ID) String() string { namespace.go
340 > return string(id)
341 > }
342
343 func (id ID) IsEmpty() bool {
345 }
346
347 > func (n Name) String() string { namespace.go
348 > return string(n)
349 > }
350
351 func (n Name) IsEmpty() bool {
go.temporal.io/server/components/nexusoperations/metrics.go 29 covered LOC · 10 ranges

Open complete file

11
12 // metricTagConfig returns the configured metric tag config (nil-safe).
13 > func (e taskExecutor) metricTagConfig() chasmnexus.NexusMetricTagConfig { metrics.go
14 > return e.Config.ResolvedMetricTagConfig()
15 > }
16
17 // operationMetricsHandler returns a metrics handler enriched with caller-side Nexus operation
25 op Operation,
26 namespaceName, workflowType string,
27 > ) metrics.Handler { metrics.go
28 > tags := []metrics.Tag{
29 > metrics.NamespaceTag(namespaceName),
30 > metrics.NexusEndpointTag(op.Endpoint),
31 > metrics.WorkflowTypeTag(workflowType),
32 > }
33 > if tagConfig.IncludeServiceTag {
34 tags = append(tags, metrics.NexusServiceTag(op.Service))
35 }
36 > if tagConfig.IncludeOperationTag { metrics.go
37 tags = append(tags, metrics.NexusOperationTag(op.Operation))
38 }
39 > return base.WithTags(tags...) metrics.go
40 }
41
48 // emitOperationFailed emits the failure counter and latency metrics for an operation that
49 // failed non-retryably.
50 > func emitOperationFailed(base metrics.Handler, tagConfig chasmnexus.NexusMetricTagConfig, op Operation, namespaceName, workflowType string, closeTime time.Time) { metrics.go
51 > emitOperationOutcome(base, tagConfig, op, namespaceName, workflowType, nexusoperationpb.OPERATION_STATUS_FAILED, closeTime, chasmnexus.NexusOperationFailedCount.With)
52 > }
53
54 // emitOperationCanceled emits the cancel counter and latency metrics for an operation that
77 withCounter func(metrics.Handler) metrics.CounterIface,
78 counterTags ...metrics.Tag,
79 > ) { metrics.go
80 > handler := operationMetricsHandler(base, tagConfig, op, namespaceName, workflowType)
81 > withCounter(handler).Record(1, counterTags...)
82 > emitCompletionLatencies(handler, op, closeTime, metrics.OutcomeTag(strings.ToLower(status.String())))
83 > }
84
85 // emitCompletionLatencies emits schedule-to-close plus either start-to-close (operations that
86 // started) or schedule-to-start (sync / never-started), mirroring chasm/lib/nexusoperation's
87 // emitLatencyMetrics. It is shared by the per-outcome recorders above.
88 > func emitCompletionLatencies(handler metrics.Handler, op Operation, closeTime time.Time, outcomeTag metrics.Tag) { metrics.go
89 > if op.ScheduledTime == nil {
90 return
91 }
92 > scheduledTime := op.ScheduledTime.AsTime() metrics.go
93 > chasmnexus.NexusOperationScheduleToCloseLatency.With(handler).Record(closeTime.Sub(scheduledTime), outcomeTag)
94 > if op.StartedTime != nil {
95 // Async operation that was started; schedule-to-start latency was emitted at start time.
96 chasmnexus.NexusOperationStartToCloseLatency.With(handler).Record(closeTime.Sub(op.StartedTime.AsTime()), outcomeTag)
97 > } else { metrics.go
98 > // Sync operation or operation that never started. metrics.go
99 > chasmnexus.NexusOperationScheduleToStartLatency.With(handler).Record(closeTime.Sub(scheduledTime))
100 > }
101 }
102
go.temporal.io/server/api/history/v1/message.pb.go 28 covered LOC · 6 ranges

Open complete file

92 func (*VersionHistoryItem) ProtoMessage() {}
93
94 > func (x *VersionHistoryItem) ProtoReflect() protoreflect.Message { message.pb.go
95 > mi := &file_temporal_server_api_history_v1_message_proto_msgTypes[1]
96 > if x != nil {
97 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
98 if ms.LoadMessageInfo() == nil {
101 return ms
102 }
103 > return mi.MessageOf(x) message.pb.go
104 }
105
198 func (*VersionHistories) ProtoMessage() {}
199
200 > func (x *VersionHistories) ProtoReflect() protoreflect.Message { message.pb.go
201 > mi := &file_temporal_server_api_history_v1_message_proto_msgTypes[3]
202 > if x != nil {
203 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
204 if ms.LoadMessageInfo() == nil {
207 return ms
208 }
209 > return mi.MessageOf(x) message.pb.go
210 }
211
498 }
499
500 > func init() { file_temporal_server_api_history_v1_message_proto_init() } message.pb.go
501 > func file_temporal_server_api_history_v1_message_proto_init() {
502 > if File_temporal_server_api_history_v1_message_proto != nil {
503 return
504 }
505 > type x struct{} message.pb.go
506 > out := protoimpl.TypeBuilder{
507 > File: protoimpl.DescBuilder{
508 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
509 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_history_v1_message_proto_rawDesc), len(file_temporal_server_api_history_v1_message_proto_rawDesc)),
510 > NumEnums: 0,
511 > NumMessages: 8,
512 > NumExtensions: 0,
513 > NumServices: 0,
514 > },
515 > GoTypes: file_temporal_server_api_history_v1_message_proto_goTypes,
516 > DependencyIndexes: file_temporal_server_api_history_v1_message_proto_depIdxs,
517 > MessageInfos: file_temporal_server_api_history_v1_message_proto_msgTypes,
518 > }.Build()
519 > File_temporal_server_api_history_v1_message_proto = out.File
520 > file_temporal_server_api_history_v1_message_proto_goTypes = nil
521 > file_temporal_server_api_history_v1_message_proto_depIdxs = nil
522 }
go.temporal.io/server/api/persistence/v1/queues.pb.go 27 covered LOC · 3 ranges

Open complete file

98 func (*QueueState) ProtoMessage() {}
99
100 > func (x *QueueState) ProtoReflect() protoreflect.Message { queues.pb.go
101 > mi := &file_temporal_server_api_persistence_v1_queues_proto_msgTypes[1]
102 > if x != nil {
103 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
104 if ms.LoadMessageInfo() == nil {
107 return ms
108 }
109 > return mi.MessageOf(x) queues.pb.go
110 }
111
616 }
617
618 > func init() { file_temporal_server_api_persistence_v1_queues_proto_init() } queues.pb.go
619 > func file_temporal_server_api_persistence_v1_queues_proto_init() {
620 > if File_temporal_server_api_persistence_v1_queues_proto != nil {
621 > return
622 > }
623 > file_temporal_server_api_persistence_v1_predicates_proto_init()
624 > type x struct{}
625 > out := protoimpl.TypeBuilder{
626 > File: protoimpl.DescBuilder{
627 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
628 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_queues_proto_rawDesc), len(file_temporal_server_api_persistence_v1_queues_proto_rawDesc)),
629 > NumEnums: 0,
630 > NumMessages: 12,
631 > NumExtensions: 0,
632 > NumServices: 0,
633 > },
634 > GoTypes: file_temporal_server_api_persistence_v1_queues_proto_goTypes,
635 > DependencyIndexes: file_temporal_server_api_persistence_v1_queues_proto_depIdxs,
636 > MessageInfos: file_temporal_server_api_persistence_v1_queues_proto_msgTypes,
637 > }.Build()
638 > File_temporal_server_api_persistence_v1_queues_proto = out.File
639 > file_temporal_server_api_persistence_v1_queues_proto_goTypes = nil
640 > file_temporal_server_api_persistence_v1_queues_proto_depIdxs = nil
641 }
go.temporal.io/server/common/nexus/link_converter.go 27 covered LOC · 6 ranges

Open complete file

140 //
141 // NOTE: Experimental
142 > func ConvertLinkWorkflowEventToNexusLink(we *commonpb.Link_WorkflowEvent) nexus.Link { link_converter.go
143 > u := &url.URL{
144 > Scheme: urlSchemeTemporalKey,
145 > Path: fmt.Sprintf(urlPathWorkflowEventTemplate, we.GetNamespace(), we.GetWorkflowId(), we.GetRunId()),
146 > RawPath: fmt.Sprintf(
147 > urlPathWorkflowEventTemplate,
148 > url.PathEscape(we.GetNamespace()),
149 > url.PathEscape(we.GetWorkflowId()),
150 > url.PathEscape(we.GetRunId()),
151 > ),
152 > }
153 >
154 > switch ref := we.GetReference().(type) {
155 > case *commonpb.Link_WorkflowEvent_EventRef: link_converter.go
156 > u.RawQuery = convertLinkWorkflowEventEventReferenceToURLQuery(ref.EventRef)
157 case *commonpb.Link_WorkflowEvent_RequestIdRef:
158 u.RawQuery = convertLinkWorkflowEventRequestIdReferenceToURLQuery(ref.RequestIdRef)
159 }
160 > return nexus.Link{ link_converter.go
161 > URL: u,
162 > Type: string(we.ProtoReflect().Descriptor().FullName()),
163 > }
164 }
165
232 }
233
234 > func convertLinkWorkflowEventEventReferenceToURLQuery(eventRef *commonpb.Link_WorkflowEvent_EventReference) string { link_converter.go
235 > values := url.Values{}
236 > values.Set(linkWorkflowEventReferenceTypeKey, eventReferenceType)
237 > if eventRef.GetEventId() > 0 {
238 > values.Set(linkEventIDKey, strconv.FormatInt(eventRef.GetEventId(), 10)) link_converter.go
239 > }
240 > values.Set(linkEventTypeKey, eventRef.GetEventType().String()) link_converter.go
241 > return values.Encode()
242 }
243
go.temporal.io/server/api/enums/v1/common.pb.go 26 covered LOC · 4 ranges

Open complete file

120 }
121
122 > func (ChecksumFlavor) Descriptor() protoreflect.EnumDescriptor { common.pb.go
123 > return file_temporal_server_api_enums_v1_common_proto_enumTypes[1].Descriptor()
124 > }
125
126 func (ChecksumFlavor) Type() protoreflect.EnumType {
201 }
202
203 > func (CallbackState) Descriptor() protoreflect.EnumDescriptor { common.pb.go
204 > return file_temporal_server_api_enums_v1_common_proto_enumTypes[2].Descriptor()
205 > }
206
207 func (CallbackState) Type() protoreflect.EnumType {
264 }
265
266 > func init() { file_temporal_server_api_enums_v1_common_proto_init() } common.pb.go
267 > func file_temporal_server_api_enums_v1_common_proto_init() {
268 > if File_temporal_server_api_enums_v1_common_proto != nil {
269 return
270 }
271 > type x struct{} common.pb.go
272 > out := protoimpl.TypeBuilder{
273 > File: protoimpl.DescBuilder{
274 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
275 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_common_proto_rawDesc), len(file_temporal_server_api_enums_v1_common_proto_rawDesc)),
276 > NumEnums: 3,
277 > NumMessages: 0,
278 > NumExtensions: 0,
279 > NumServices: 0,
280 > },
281 > GoTypes: file_temporal_server_api_enums_v1_common_proto_goTypes,
282 > DependencyIndexes: file_temporal_server_api_enums_v1_common_proto_depIdxs,
283 > EnumInfos: file_temporal_server_api_enums_v1_common_proto_enumTypes,
284 > }.Build()
285 > File_temporal_server_api_enums_v1_common_proto = out.File
286 > file_temporal_server_api_enums_v1_common_proto_goTypes = nil
287 > file_temporal_server_api_enums_v1_common_proto_depIdxs = nil
288 }
go.temporal.io/server/api/enums/v1/task.pb.go 26 covered LOC · 4 ranges

Open complete file

303 }
304
305 > func (TaskType) Descriptor() protoreflect.EnumDescriptor { task.pb.go
306 > return file_temporal_server_api_enums_v1_task_proto_enumTypes[1].Descriptor()
307 > }
308
309 func (TaskType) Type() protoreflect.EnumType {
361 }
362
363 > func (TaskPriority) Descriptor() protoreflect.EnumDescriptor { task.pb.go
364 > return file_temporal_server_api_enums_v1_task_proto_enumTypes[2].Descriptor()
365 > }
366
367 func (TaskPriority) Type() protoreflect.EnumType {
456 }
457
458 > func init() { file_temporal_server_api_enums_v1_task_proto_init() } task.pb.go
459 > func file_temporal_server_api_enums_v1_task_proto_init() {
460 > if File_temporal_server_api_enums_v1_task_proto != nil {
461 return
462 }
463 > type x struct{} task.pb.go
464 > out := protoimpl.TypeBuilder{
465 > File: protoimpl.DescBuilder{
466 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
467 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_task_proto_rawDesc), len(file_temporal_server_api_enums_v1_task_proto_rawDesc)),
468 > NumEnums: 3,
469 > NumMessages: 0,
470 > NumExtensions: 0,
471 > NumServices: 0,
472 > },
473 > GoTypes: file_temporal_server_api_enums_v1_task_proto_goTypes,
474 > DependencyIndexes: file_temporal_server_api_enums_v1_task_proto_depIdxs,
475 > EnumInfos: file_temporal_server_api_enums_v1_task_proto_enumTypes,
476 > }.Build()
477 > File_temporal_server_api_enums_v1_task_proto = out.File
478 > file_temporal_server_api_enums_v1_task_proto_goTypes = nil
479 > file_temporal_server_api_enums_v1_task_proto_depIdxs = nil
480 }
go.temporal.io/server/api/enums/v1/workflow.pb.go 26 covered LOC · 4 ranges

Open complete file

86 }
87
88 > func (WorkflowExecutionState) Descriptor() protoreflect.EnumDescriptor { workflow.pb.go
89 > return file_temporal_server_api_enums_v1_workflow_proto_enumTypes[0].Descriptor()
90 > }
91
92 func (WorkflowExecutionState) Type() protoreflect.EnumType {
150 }
151
152 > func (WorkflowBackoffType) Descriptor() protoreflect.EnumDescriptor { workflow.pb.go
153 > return file_temporal_server_api_enums_v1_workflow_proto_enumTypes[1].Descriptor()
154 > }
155
156 func (WorkflowBackoffType) Type() protoreflect.EnumType {
275 }
276
277 > func init() { file_temporal_server_api_enums_v1_workflow_proto_init() } workflow.pb.go
278 > func file_temporal_server_api_enums_v1_workflow_proto_init() {
279 > if File_temporal_server_api_enums_v1_workflow_proto != nil {
280 return
281 }
282 > type x struct{} workflow.pb.go
283 > out := protoimpl.TypeBuilder{
284 > File: protoimpl.DescBuilder{
285 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
286 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_workflow_proto_rawDesc), len(file_temporal_server_api_enums_v1_workflow_proto_rawDesc)),
287 > NumEnums: 3,
288 > NumMessages: 0,
289 > NumExtensions: 0,
290 > NumServices: 0,
291 > },
292 > GoTypes: file_temporal_server_api_enums_v1_workflow_proto_goTypes,
293 > DependencyIndexes: file_temporal_server_api_enums_v1_workflow_proto_depIdxs,
294 > EnumInfos: file_temporal_server_api_enums_v1_workflow_proto_enumTypes,
295 > }.Build()
296 > File_temporal_server_api_enums_v1_workflow_proto = out.File
297 > file_temporal_server_api_enums_v1_workflow_proto_goTypes = nil
298 > file_temporal_server_api_enums_v1_workflow_proto_depIdxs = nil
299 }
go.temporal.io/server/common/routing/route.go 25 covered LOC · 8 ranges

Open complete file

36
37 // NewRoute returns a new [Route] instance with the given components.
38 > func NewRoute[T any](components ...Component[T]) Route[T] { route.go
39 > return Route[T]{components: components}
40 > }
41
42 // RouteBuilder is a builder for the [Route] interface.
46
47 // NewBuilder creates a new [RouteBuilder] instance, which can be used to define a new [Route] via a fluent API.
48 > func NewBuilder[T any]() *RouteBuilder[T] { route.go
49 > return &RouteBuilder[T]{}
50 > }
51
52 // With adds a series of [Component] instances to the [Route].
53 > func (r *RouteBuilder[T]) With(c ...Component[T]) *RouteBuilder[T] { route.go
54 > r.components = append(r.components, c...)
55 > return r
56 > }
57
58 // Constant adds a [Constant] component to the [Route].
59 > func (r *RouteBuilder[T]) Constant(values ...string) *RouteBuilder[T] { route.go
60 > return r.With(Constant[T](values...))
61 > }
62
63 // StringVariable adds a [StringVariable] component to the [Route].
64 > func (r *RouteBuilder[T]) StringVariable(name string, getter func(*T) *string) *RouteBuilder[T] { route.go
65 > return r.With(StringVariable[T](name, getter))
66 > }
67
68 // Build returns a read-only [Route].
69 > func (r *RouteBuilder[T]) Build() Route[T] { route.go
70 > return NewRoute[T](r.components...)
71 > }
72
73 // Representation returns the [github.com/gorilla/mux] compatible string representation of the route for usage in a
111 // Constant returns a [Component] that represents a series of constant HTTP path components in a Route.
112 // They will be joined via strings when used to construct a path or path representation.
113 > func Constant[T any](values ...string) constant[T] { route.go
114 > return values
115 > }
116
117 type constant[T any] []string
128
129 // StringVariable returns a [Component] that represents a string variable in a Route.
130 > func StringVariable[T any](name string, getter func(*T) *string) stringVariable[T] { route.go
131 > return stringVariable[T]{name, getter}
132 > }
133
134 type stringVariable[T any] struct {
go.temporal.io/server/api/clock/v1/message.pb.go 24 covered LOC · 4 ranges

Open complete file

45 func (*VectorClock) ProtoMessage() {}
46
47 > func (x *VectorClock) ProtoReflect() protoreflect.Message { message.pb.go
48 > mi := &file_temporal_server_api_clock_v1_message_proto_msgTypes[0]
49 > if x != nil {
50 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
51 if ms.LoadMessageInfo() == nil {
54 return ms
55 }
56 > return mi.MessageOf(x) message.pb.go
57 }
58
193 }
194
195 > func init() { file_temporal_server_api_clock_v1_message_proto_init() } message.pb.go
196 > func file_temporal_server_api_clock_v1_message_proto_init() {
197 > if File_temporal_server_api_clock_v1_message_proto != nil {
198 return
199 }
200 > type x struct{} message.pb.go
201 > out := protoimpl.TypeBuilder{
202 > File: protoimpl.DescBuilder{
203 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
204 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_clock_v1_message_proto_rawDesc), len(file_temporal_server_api_clock_v1_message_proto_rawDesc)),
205 > NumEnums: 0,
206 > NumMessages: 2,
207 > NumExtensions: 0,
208 > NumServices: 0,
209 > },
210 > GoTypes: file_temporal_server_api_clock_v1_message_proto_goTypes,
211 > DependencyIndexes: file_temporal_server_api_clock_v1_message_proto_depIdxs,
212 > MessageInfos: file_temporal_server_api_clock_v1_message_proto_msgTypes,
213 > }.Build()
214 > File_temporal_server_api_clock_v1_message_proto = out.File
215 > file_temporal_server_api_clock_v1_message_proto_goTypes = nil
216 > file_temporal_server_api_clock_v1_message_proto_depIdxs = nil
217 }
go.temporal.io/server/api/persistence/v1/workflow_mutable_state.pb.go 24 covered LOC · 2 ranges

Open complete file

532 }
533
534 > func init() { file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_init() } workflow_mutable_state.pb.go
535 > func file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_init() {
536 > if File_temporal_server_api_persistence_v1_workflow_mutable_state_proto != nil {
537 return
538 }
539 > file_temporal_server_api_persistence_v1_chasm_proto_init() workflow_mutable_state.pb.go
540 > file_temporal_server_api_persistence_v1_executions_proto_init()
541 > file_temporal_server_api_persistence_v1_hsm_proto_init()
542 > file_temporal_server_api_persistence_v1_update_proto_init()
543 > type x struct{}
544 > out := protoimpl.TypeBuilder{
545 > File: protoimpl.DescBuilder{
546 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
547 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_rawDesc), len(file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_rawDesc)),
548 > NumEnums: 0,
549 > NumMessages: 16,
550 > NumExtensions: 0,
551 > NumServices: 0,
552 > },
553 > GoTypes: file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_goTypes,
554 > DependencyIndexes: file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_depIdxs,
555 > MessageInfos: file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_msgTypes,
556 > }.Build()
557 > File_temporal_server_api_persistence_v1_workflow_mutable_state_proto = out.File
558 > file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_goTypes = nil
559 > file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_depIdxs = nil
560 }
go.temporal.io/server/api/workflow/v1/message.pb.go 24 covered LOC · 4 ranges

Open complete file

189 func (*BaseExecutionInfo) ProtoMessage() {}
190
191 > func (x *BaseExecutionInfo) ProtoReflect() protoreflect.Message { message.pb.go
192 > mi := &file_temporal_server_api_workflow_v1_message_proto_msgTypes[2]
193 > if x != nil {
194 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
195 if ms.LoadMessageInfo() == nil {
198 return ms
199 }
200 > return mi.MessageOf(x) message.pb.go
201 }
202
278 }
279
280 > func init() { file_temporal_server_api_workflow_v1_message_proto_init() } message.pb.go
281 > func file_temporal_server_api_workflow_v1_message_proto_init() {
282 > if File_temporal_server_api_workflow_v1_message_proto != nil {
283 return
284 }
285 > type x struct{} message.pb.go
286 > out := protoimpl.TypeBuilder{
287 > File: protoimpl.DescBuilder{
288 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
289 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_workflow_v1_message_proto_rawDesc), len(file_temporal_server_api_workflow_v1_message_proto_rawDesc)),
290 > NumEnums: 0,
291 > NumMessages: 3,
292 > NumExtensions: 0,
293 > NumServices: 0,
294 > },
295 > GoTypes: file_temporal_server_api_workflow_v1_message_proto_goTypes,
296 > DependencyIndexes: file_temporal_server_api_workflow_v1_message_proto_depIdxs,
297 > MessageInfos: file_temporal_server_api_workflow_v1_message_proto_msgTypes,
298 > }.Build()
299 > File_temporal_server_api_workflow_v1_message_proto = out.File
300 > file_temporal_server_api_workflow_v1_message_proto_goTypes = nil
301 > file_temporal_server_api_workflow_v1_message_proto_depIdxs = nil
302 }
go.temporal.io/server/chasm/lib/callback/gen/callbackpb/v1/message.pb.go 24 covered LOC · 2 ranges

Open complete file

462 }
463
464 > func init() { file_temporal_server_chasm_lib_callback_proto_v1_message_proto_init() } message.pb.go
465 > func file_temporal_server_chasm_lib_callback_proto_v1_message_proto_init() {
466 > if File_temporal_server_chasm_lib_callback_proto_v1_message_proto != nil {
467 return
468 }
469 > file_temporal_server_chasm_lib_callback_proto_v1_message_proto_msgTypes[1].OneofWrappers = []any{ message.pb.go
470 > (*Callback_Nexus_)(nil),
471 > }
472 > type x struct{}
473 > out := protoimpl.TypeBuilder{
474 > File: protoimpl.DescBuilder{
475 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
476 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_callback_proto_v1_message_proto_rawDesc), len(file_temporal_server_chasm_lib_callback_proto_v1_message_proto_rawDesc)),
477 > NumEnums: 1,
478 > NumMessages: 5,
479 > NumExtensions: 0,
480 > NumServices: 0,
481 > },
482 > GoTypes: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_goTypes,
483 > DependencyIndexes: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_depIdxs,
484 > EnumInfos: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_enumTypes,
485 > MessageInfos: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_msgTypes,
486 > }.Build()
487 > File_temporal_server_chasm_lib_callback_proto_v1_message_proto = out.File
488 > file_temporal_server_chasm_lib_callback_proto_v1_message_proto_goTypes = nil
489 > file_temporal_server_chasm_lib_callback_proto_v1_message_proto_depIdxs = nil
490 }
go.temporal.io/server/api/enums/v1/nexus.pb.go 23 covered LOC · 3 ranges

Open complete file

102 }
103
104 > func (NexusOperationState) Descriptor() protoreflect.EnumDescriptor { nexus.pb.go
105 > return file_temporal_server_api_enums_v1_nexus_proto_enumTypes[0].Descriptor()
106 > }
107
108 func (NexusOperationState) Type() protoreflect.EnumType {
158 }
159
160 > func init() { file_temporal_server_api_enums_v1_nexus_proto_init() } nexus.pb.go
161 > func file_temporal_server_api_enums_v1_nexus_proto_init() {
162 > if File_temporal_server_api_enums_v1_nexus_proto != nil {
163 return
164 }
165 > type x struct{} nexus.pb.go
166 > out := protoimpl.TypeBuilder{
167 > File: protoimpl.DescBuilder{
168 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
169 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_nexus_proto_rawDesc), len(file_temporal_server_api_enums_v1_nexus_proto_rawDesc)),
170 > NumEnums: 1,
171 > NumMessages: 0,
172 > NumExtensions: 0,
173 > NumServices: 0,
174 > },
175 > GoTypes: file_temporal_server_api_enums_v1_nexus_proto_goTypes,
176 > DependencyIndexes: file_temporal_server_api_enums_v1_nexus_proto_depIdxs,
177 > EnumInfos: file_temporal_server_api_enums_v1_nexus_proto_enumTypes,
178 > }.Build()
179 > File_temporal_server_api_enums_v1_nexus_proto = out.File
180 > file_temporal_server_api_enums_v1_nexus_proto_goTypes = nil
181 > file_temporal_server_api_enums_v1_nexus_proto_depIdxs = nil
182 }
go.temporal.io/server/api/enums/v1/predicate.pb.go 23 covered LOC · 3 ranges

Open complete file

111 }
112
113 > func (PredicateType) Descriptor() protoreflect.EnumDescriptor { predicate.pb.go
114 > return file_temporal_server_api_enums_v1_predicate_proto_enumTypes[0].Descriptor()
115 > }
116
117 func (PredicateType) Type() protoreflect.EnumType {
170 }
171
172 > func init() { file_temporal_server_api_enums_v1_predicate_proto_init() } predicate.pb.go
173 > func file_temporal_server_api_enums_v1_predicate_proto_init() {
174 > if File_temporal_server_api_enums_v1_predicate_proto != nil {
175 return
176 }
177 > type x struct{} predicate.pb.go
178 > out := protoimpl.TypeBuilder{
179 > File: protoimpl.DescBuilder{
180 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
181 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_predicate_proto_rawDesc), len(file_temporal_server_api_enums_v1_predicate_proto_rawDesc)),
182 > NumEnums: 1,
183 > NumMessages: 0,
184 > NumExtensions: 0,
185 > NumServices: 0,
186 > },
187 > GoTypes: file_temporal_server_api_enums_v1_predicate_proto_goTypes,
188 > DependencyIndexes: file_temporal_server_api_enums_v1_predicate_proto_depIdxs,
189 > EnumInfos: file_temporal_server_api_enums_v1_predicate_proto_enumTypes,
190 > }.Build()
191 > File_temporal_server_api_enums_v1_predicate_proto = out.File
192 > file_temporal_server_api_enums_v1_predicate_proto_goTypes = nil
193 > file_temporal_server_api_enums_v1_predicate_proto_depIdxs = nil
194 }
go.temporal.io/server/api/enums/v1/workflow_task_type.pb.go 23 covered LOC · 3 ranges

Open complete file

72 }
73
74 > func (WorkflowTaskType) Descriptor() protoreflect.EnumDescriptor { workflow_task_type.pb.go
75 > return file_temporal_server_api_enums_v1_workflow_task_type_proto_enumTypes[0].Descriptor()
76 > }
77
78 func (WorkflowTaskType) Type() protoreflect.EnumType {
124 }
125
126 > func init() { file_temporal_server_api_enums_v1_workflow_task_type_proto_init() } workflow_task_type.pb.go
127 > func file_temporal_server_api_enums_v1_workflow_task_type_proto_init() {
128 > if File_temporal_server_api_enums_v1_workflow_task_type_proto != nil {
129 return
130 }
131 > type x struct{} workflow_task_type.pb.go
132 > out := protoimpl.TypeBuilder{
133 > File: protoimpl.DescBuilder{
134 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
135 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_workflow_task_type_proto_rawDesc), len(file_temporal_server_api_enums_v1_workflow_task_type_proto_rawDesc)),
136 > NumEnums: 1,
137 > NumMessages: 0,
138 > NumExtensions: 0,
139 > NumServices: 0,
140 > },
141 > GoTypes: file_temporal_server_api_enums_v1_workflow_task_type_proto_goTypes,
142 > DependencyIndexes: file_temporal_server_api_enums_v1_workflow_task_type_proto_depIdxs,
143 > EnumInfos: file_temporal_server_api_enums_v1_workflow_task_type_proto_enumTypes,
144 > }.Build()
145 > File_temporal_server_api_enums_v1_workflow_task_type_proto = out.File
146 > file_temporal_server_api_enums_v1_workflow_task_type_proto_goTypes = nil
147 > file_temporal_server_api_enums_v1_workflow_task_type_proto_depIdxs = nil
148 }
go.temporal.io/server/common/metrics/tags.go 23 covered LOC · 10 ranges

Open complete file

101 // dual emit the metric with the all tag. If a blank namespace is provided then
102 // this converts that to an unknown namespace.
103 > func NamespaceTag(value string) Tag { tags.go
104 > if len(value) == 0 {
105 value = unknownValue
106 }
107 > return Tag{Key: namespace, Value: value} tags.go
108 }
109
213
214 // WorkflowTypeTag returns a new workflow type tag.
215 > func WorkflowTypeTag(value string) Tag { tags.go
216 > if len(value) == 0 {
217 value = unknownValue
218 }
219 > return Tag{Key: workflowType, Value: value} tags.go
220 }
221
265 }
266
267 > func FailureSourceTag(value string) Tag { tags.go
268 > if len(value) == 0 {
269 > value = unknownValue
270 > }
271 > return Tag{Key: FailureSourceTagName, Value: value}
272 }
273
411 }
412
413 > func OutcomeTag(outcome string) Tag { tags.go
414 > return Tag{Key: outcomeTagName, Value: outcome}
415 > }
416
417 > func NexusMethodTag(value string) Tag { tags.go
418 > return Tag{Key: nexusMethodTagName, Value: value}
419 > }
420
421 > func NexusEndpointTag(value string) Tag { tags.go
422 > if len(value) == 0 {
423 value = unknownValue
424 }
425 > return Tag{Key: nexusEndpointTagName, Value: value} tags.go
426 }
427
492
493 // DestinationTag is a tag for metrics emitted by outbound task executors for the task's destination.
494 > func DestinationTag(value string) Tag { tags.go
495 > return Tag{Key: destination, Value: value}
496 > }
497
498 func VersioningBehaviorTag(behavior enumspb.VersioningBehavior) Tag {
go.temporal.io/server/api/common/v1/api_category.pb.go 22 covered LOC · 2 ranges

Open complete file

204 }
205
206 > func init() { file_temporal_server_api_common_v1_api_category_proto_init() } api_category.pb.go
207 > func file_temporal_server_api_common_v1_api_category_proto_init() {
208 > if File_temporal_server_api_common_v1_api_category_proto != nil {
209 return
210 }
211 > type x struct{} api_category.pb.go
212 > out := protoimpl.TypeBuilder{
213 > File: protoimpl.DescBuilder{
214 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
215 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_common_v1_api_category_proto_rawDesc), len(file_temporal_server_api_common_v1_api_category_proto_rawDesc)),
216 > NumEnums: 1,
217 > NumMessages: 1,
218 > NumExtensions: 1,
219 > NumServices: 0,
220 > },
221 > GoTypes: file_temporal_server_api_common_v1_api_category_proto_goTypes,
222 > DependencyIndexes: file_temporal_server_api_common_v1_api_category_proto_depIdxs,
223 > EnumInfos: file_temporal_server_api_common_v1_api_category_proto_enumTypes,
224 > MessageInfos: file_temporal_server_api_common_v1_api_category_proto_msgTypes,
225 > ExtensionInfos: file_temporal_server_api_common_v1_api_category_proto_extTypes,
226 > }.Build()
227 > File_temporal_server_api_common_v1_api_category_proto = out.File
228 > file_temporal_server_api_common_v1_api_category_proto_goTypes = nil
229 > file_temporal_server_api_common_v1_api_category_proto_depIdxs = nil
230 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/request_response.pb.go 22 covered LOC · 1 range

Open complete file

672 }
673
674 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_init() } request_response.pb.go
675 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_init() {
676 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto != nil {
677 > return
678 > }
679 > type x struct{}
680 > out := protoimpl.TypeBuilder{
681 > File: protoimpl.DescBuilder{
682 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
683 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_rawDesc)),
684 > NumEnums: 0,
685 > NumMessages: 12,
686 > NumExtensions: 0,
687 > NumServices: 0,
688 > },
689 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_goTypes,
690 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_depIdxs,
691 > MessageInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_msgTypes,
692 > }.Build()
693 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto = out.File
694 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_goTypes = nil
695 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_depIdxs = nil
696 }
go.temporal.io/server/api/persistence/v1/task_queues.pb.go 21 covered LOC · 2 ranges

Open complete file

899 }
900
901 > func init() { file_temporal_server_api_persistence_v1_task_queues_proto_init() } task_queues.pb.go
902 > func file_temporal_server_api_persistence_v1_task_queues_proto_init() {
903 > if File_temporal_server_api_persistence_v1_task_queues_proto != nil {
904 return
905 }
906 > type x struct{} task_queues.pb.go
907 > out := protoimpl.TypeBuilder{
908 > File: protoimpl.DescBuilder{
909 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
910 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_task_queues_proto_rawDesc), len(file_temporal_server_api_persistence_v1_task_queues_proto_rawDesc)),
911 > NumEnums: 1,
912 > NumMessages: 13,
913 > NumExtensions: 0,
914 > NumServices: 0,
915 > },
916 > GoTypes: file_temporal_server_api_persistence_v1_task_queues_proto_goTypes,
917 > DependencyIndexes: file_temporal_server_api_persistence_v1_task_queues_proto_depIdxs,
918 > EnumInfos: file_temporal_server_api_persistence_v1_task_queues_proto_enumTypes,
919 > MessageInfos: file_temporal_server_api_persistence_v1_task_queues_proto_msgTypes,
920 > }.Build()
921 > File_temporal_server_api_persistence_v1_task_queues_proto = out.File
922 > file_temporal_server_api_persistence_v1_task_queues_proto_goTypes = nil
923 > file_temporal_server_api_persistence_v1_task_queues_proto_depIdxs = nil
924 }
go.temporal.io/server/api/routing/v1/extension.pb.go 21 covered LOC · 2 ranges

Open complete file

144 }
145
146 > func init() { file_temporal_server_api_routing_v1_extension_proto_init() } extension.pb.go
147 > func file_temporal_server_api_routing_v1_extension_proto_init() {
148 > if File_temporal_server_api_routing_v1_extension_proto != nil {
149 return
150 }
151 > type x struct{} extension.pb.go
152 > out := protoimpl.TypeBuilder{
153 > File: protoimpl.DescBuilder{
154 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
155 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_routing_v1_extension_proto_rawDesc), len(file_temporal_server_api_routing_v1_extension_proto_rawDesc)),
156 > NumEnums: 0,
157 > NumMessages: 1,
158 > NumExtensions: 1,
159 > NumServices: 0,
160 > },
161 > GoTypes: file_temporal_server_api_routing_v1_extension_proto_goTypes,
162 > DependencyIndexes: file_temporal_server_api_routing_v1_extension_proto_depIdxs,
163 > MessageInfos: file_temporal_server_api_routing_v1_extension_proto_msgTypes,
164 > ExtensionInfos: file_temporal_server_api_routing_v1_extension_proto_extTypes,
165 > }.Build()
166 > File_temporal_server_api_routing_v1_extension_proto = out.File
167 > file_temporal_server_api_routing_v1_extension_proto_goTypes = nil
168 > file_temporal_server_api_routing_v1_extension_proto_depIdxs = nil
169 }
go.temporal.io/server/components/nexusoperations/tasks.go 21 covered LOC · 7 ranges

Open complete file

35 var _ hsm.Task = ScheduleToCloseTimeoutTask{}
36
37 > func (ScheduleToCloseTimeoutTask) Type() string { tasks.go
38 > return TaskTypeScheduleToCloseTimeout
39 > }
40
41 func (t ScheduleToCloseTimeoutTask) Deadline() time.Time {
84 var _ hsm.Task = InvocationTask{}
85
86 > func (InvocationTask) Type() string { tasks.go
87 > return TaskTypeInvocation
88 > }
89
90 func (InvocationTask) Deadline() time.Time {
129 var _ hsm.Task = BackoffTask{}
130
131 > func (BackoffTask) Type() string { tasks.go
132 > return TaskTypeBackoff
133 > }
134
135 func (t BackoffTask) Deadline() time.Time {
165 var _ hsm.Task = CancelationTask{}
166
167 > func (CancelationTask) Type() string { tasks.go
168 > return TaskTypeCancelation
169 > }
170
171 func (CancelationTask) Deadline() time.Time {
210 var _ hsm.Task = CancelationBackoffTask{}
211
212 > func (CancelationBackoffTask) Type() string { tasks.go
213 > return TaskTypeCancelationBackoff
214 > }
215
216 func (t CancelationBackoffTask) Deadline() time.Time {
245 var _ hsm.Task = ScheduleToStartTimeoutTask{}
246
247 > func (ScheduleToStartTimeoutTask) Type() string { tasks.go
248 > return TaskTypeScheduleToStartTimeout
249 > }
250
251 func (t ScheduleToStartTimeoutTask) Deadline() time.Time {
299 var _ hsm.Task = StartToCloseTimeoutTask{}
300
301 > func (StartToCloseTimeoutTask) Type() string { tasks.go
302 > return TaskTypeStartToCloseTimeout
303 > }
304
305 func (t StartToCloseTimeoutTask) Deadline() time.Time {
go.temporal.io/server/api/adminservice/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

273 }
274
275 > func init() { file_temporal_server_api_adminservice_v1_service_proto_init() } service.pb.go
276 > func file_temporal_server_api_adminservice_v1_service_proto_init() {
277 > if File_temporal_server_api_adminservice_v1_service_proto != nil {
278 return
279 }
280 > file_temporal_server_api_adminservice_v1_request_response_proto_init() service.pb.go
281 > type x struct{}
282 > out := protoimpl.TypeBuilder{
283 > File: protoimpl.DescBuilder{
284 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
285 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_adminservice_v1_service_proto_rawDesc), len(file_temporal_server_api_adminservice_v1_service_proto_rawDesc)),
286 > NumEnums: 0,
287 > NumMessages: 0,
288 > NumExtensions: 0,
289 > NumServices: 1,
290 > },
291 > GoTypes: file_temporal_server_api_adminservice_v1_service_proto_goTypes,
292 > DependencyIndexes: file_temporal_server_api_adminservice_v1_service_proto_depIdxs,
293 > }.Build()
294 > File_temporal_server_api_adminservice_v1_service_proto = out.File
295 > file_temporal_server_api_adminservice_v1_service_proto_goTypes = nil
296 > file_temporal_server_api_adminservice_v1_service_proto_depIdxs = nil
297 }
go.temporal.io/server/api/archiver/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

431 }
432
433 > func init() { file_temporal_server_api_archiver_v1_message_proto_init() } message.pb.go
434 > func file_temporal_server_api_archiver_v1_message_proto_init() {
435 > if File_temporal_server_api_archiver_v1_message_proto != nil {
436 return
437 }
438 > type x struct{} message.pb.go
439 > out := protoimpl.TypeBuilder{
440 > File: protoimpl.DescBuilder{
441 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
442 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_archiver_v1_message_proto_rawDesc), len(file_temporal_server_api_archiver_v1_message_proto_rawDesc)),
443 > NumEnums: 0,
444 > NumMessages: 4,
445 > NumExtensions: 0,
446 > NumServices: 0,
447 > },
448 > GoTypes: file_temporal_server_api_archiver_v1_message_proto_goTypes,
449 > DependencyIndexes: file_temporal_server_api_archiver_v1_message_proto_depIdxs,
450 > MessageInfos: file_temporal_server_api_archiver_v1_message_proto_msgTypes,
451 > }.Build()
452 > File_temporal_server_api_archiver_v1_message_proto = out.File
453 > file_temporal_server_api_archiver_v1_message_proto_goTypes = nil
454 > file_temporal_server_api_archiver_v1_message_proto_depIdxs = nil
455 }
go.temporal.io/server/api/chasm/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

206 }
207
208 > func init() { file_temporal_server_api_chasm_v1_message_proto_init() } message.pb.go
209 > func file_temporal_server_api_chasm_v1_message_proto_init() {
210 > if File_temporal_server_api_chasm_v1_message_proto != nil {
211 return
212 }
213 > type x struct{} message.pb.go
214 > out := protoimpl.TypeBuilder{
215 > File: protoimpl.DescBuilder{
216 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
217 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_chasm_v1_message_proto_rawDesc), len(file_temporal_server_api_chasm_v1_message_proto_rawDesc)),
218 > NumEnums: 0,
219 > NumMessages: 1,
220 > NumExtensions: 0,
221 > NumServices: 0,
222 > },
223 > GoTypes: file_temporal_server_api_chasm_v1_message_proto_goTypes,
224 > DependencyIndexes: file_temporal_server_api_chasm_v1_message_proto_depIdxs,
225 > MessageInfos: file_temporal_server_api_chasm_v1_message_proto_msgTypes,
226 > }.Build()
227 > File_temporal_server_api_chasm_v1_message_proto = out.File
228 > file_temporal_server_api_chasm_v1_message_proto_goTypes = nil
229 > file_temporal_server_api_chasm_v1_message_proto_depIdxs = nil
230 }
go.temporal.io/server/api/checksum/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

334 }
335
336 > func init() { file_temporal_server_api_checksum_v1_message_proto_init() } message.pb.go
337 > func file_temporal_server_api_checksum_v1_message_proto_init() {
338 > if File_temporal_server_api_checksum_v1_message_proto != nil {
339 return
340 }
341 > type x struct{} message.pb.go
342 > out := protoimpl.TypeBuilder{
343 > File: protoimpl.DescBuilder{
344 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
345 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_checksum_v1_message_proto_rawDesc), len(file_temporal_server_api_checksum_v1_message_proto_rawDesc)),
346 > NumEnums: 0,
347 > NumMessages: 1,
348 > NumExtensions: 0,
349 > NumServices: 0,
350 > },
351 > GoTypes: file_temporal_server_api_checksum_v1_message_proto_goTypes,
352 > DependencyIndexes: file_temporal_server_api_checksum_v1_message_proto_depIdxs,
353 > MessageInfos: file_temporal_server_api_checksum_v1_message_proto_msgTypes,
354 > }.Build()
355 > File_temporal_server_api_checksum_v1_message_proto = out.File
356 > file_temporal_server_api_checksum_v1_message_proto_goTypes = nil
357 > file_temporal_server_api_checksum_v1_message_proto_depIdxs = nil
358 }
go.temporal.io/server/api/cluster/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

342 }
343
344 > func init() { file_temporal_server_api_cluster_v1_message_proto_init() } message.pb.go
345 > func file_temporal_server_api_cluster_v1_message_proto_init() {
346 > if File_temporal_server_api_cluster_v1_message_proto != nil {
347 return
348 }
349 > type x struct{} message.pb.go
350 > out := protoimpl.TypeBuilder{
351 > File: protoimpl.DescBuilder{
352 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
353 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_cluster_v1_message_proto_rawDesc), len(file_temporal_server_api_cluster_v1_message_proto_rawDesc)),
354 > NumEnums: 0,
355 > NumMessages: 4,
356 > NumExtensions: 0,
357 > NumServices: 0,
358 > },
359 > GoTypes: file_temporal_server_api_cluster_v1_message_proto_goTypes,
360 > DependencyIndexes: file_temporal_server_api_cluster_v1_message_proto_depIdxs,
361 > MessageInfos: file_temporal_server_api_cluster_v1_message_proto_msgTypes,
362 > }.Build()
363 > File_temporal_server_api_cluster_v1_message_proto = out.File
364 > file_temporal_server_api_cluster_v1_message_proto_goTypes = nil
365 > file_temporal_server_api_cluster_v1_message_proto_depIdxs = nil
366 }
go.temporal.io/server/api/common/v1/dlq.pb.go 20 covered LOC · 2 ranges

Open complete file

295 }
296
297 > func init() { file_temporal_server_api_common_v1_dlq_proto_init() } dlq.pb.go
298 > func file_temporal_server_api_common_v1_dlq_proto_init() {
299 > if File_temporal_server_api_common_v1_dlq_proto != nil {
300 return
301 }
302 > type x struct{} dlq.pb.go
303 > out := protoimpl.TypeBuilder{
304 > File: protoimpl.DescBuilder{
305 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
306 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_common_v1_dlq_proto_rawDesc), len(file_temporal_server_api_common_v1_dlq_proto_rawDesc)),
307 > NumEnums: 0,
308 > NumMessages: 4,
309 > NumExtensions: 0,
310 > NumServices: 0,
311 > },
312 > GoTypes: file_temporal_server_api_common_v1_dlq_proto_goTypes,
313 > DependencyIndexes: file_temporal_server_api_common_v1_dlq_proto_depIdxs,
314 > MessageInfos: file_temporal_server_api_common_v1_dlq_proto_msgTypes,
315 > }.Build()
316 > File_temporal_server_api_common_v1_dlq_proto = out.File
317 > file_temporal_server_api_common_v1_dlq_proto_goTypes = nil
318 > file_temporal_server_api_common_v1_dlq_proto_depIdxs = nil
319 }
go.temporal.io/server/api/contextpropagation/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

109 }
110
111 > func init() { file_temporal_server_api_contextpropagation_v1_message_proto_init() } message.pb.go
112 > func file_temporal_server_api_contextpropagation_v1_message_proto_init() {
113 > if File_temporal_server_api_contextpropagation_v1_message_proto != nil {
114 return
115 }
116 > type x struct{} message.pb.go
117 > out := protoimpl.TypeBuilder{
118 > File: protoimpl.DescBuilder{
119 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
120 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_contextpropagation_v1_message_proto_rawDesc), len(file_temporal_server_api_contextpropagation_v1_message_proto_rawDesc)),
121 > NumEnums: 0,
122 > NumMessages: 2,
123 > NumExtensions: 0,
124 > NumServices: 0,
125 > },
126 > GoTypes: file_temporal_server_api_contextpropagation_v1_message_proto_goTypes,
127 > DependencyIndexes: file_temporal_server_api_contextpropagation_v1_message_proto_depIdxs,
128 > MessageInfos: file_temporal_server_api_contextpropagation_v1_message_proto_msgTypes,
129 > }.Build()
130 > File_temporal_server_api_contextpropagation_v1_message_proto = out.File
131 > file_temporal_server_api_contextpropagation_v1_message_proto_goTypes = nil
132 > file_temporal_server_api_contextpropagation_v1_message_proto_depIdxs = nil
133 }
go.temporal.io/server/api/deployment/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

4626 }
4627
4628 > func init() { file_temporal_server_api_deployment_v1_message_proto_init() } message.pb.go
4629 > func file_temporal_server_api_deployment_v1_message_proto_init() {
4630 > if File_temporal_server_api_deployment_v1_message_proto != nil {
4631 return
4632 }
4633 > type x struct{} message.pb.go
4634 > out := protoimpl.TypeBuilder{
4635 > File: protoimpl.DescBuilder{
4636 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
4637 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_deployment_v1_message_proto_rawDesc), len(file_temporal_server_api_deployment_v1_message_proto_rawDesc)),
4638 > NumEnums: 0,
4639 > NumMessages: 75,
4640 > NumExtensions: 0,
4641 > NumServices: 0,
4642 > },
4643 > GoTypes: file_temporal_server_api_deployment_v1_message_proto_goTypes,
4644 > DependencyIndexes: file_temporal_server_api_deployment_v1_message_proto_depIdxs,
4645 > MessageInfos: file_temporal_server_api_deployment_v1_message_proto_msgTypes,
4646 > }.Build()
4647 > File_temporal_server_api_deployment_v1_message_proto = out.File
4648 > file_temporal_server_api_deployment_v1_message_proto_goTypes = nil
4649 > file_temporal_server_api_deployment_v1_message_proto_depIdxs = nil
4650 }
go.temporal.io/server/api/enums/v1/cluster.pb.go 20 covered LOC · 2 ranges

Open complete file

209 }
210
211 > func init() { file_temporal_server_api_enums_v1_cluster_proto_init() } cluster.pb.go
212 > func file_temporal_server_api_enums_v1_cluster_proto_init() {
213 > if File_temporal_server_api_enums_v1_cluster_proto != nil {
214 return
215 }
216 > type x struct{} cluster.pb.go
217 > out := protoimpl.TypeBuilder{
218 > File: protoimpl.DescBuilder{
219 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
220 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_cluster_proto_rawDesc), len(file_temporal_server_api_enums_v1_cluster_proto_rawDesc)),
221 > NumEnums: 2,
222 > NumMessages: 0,
223 > NumExtensions: 0,
224 > NumServices: 0,
225 > },
226 > GoTypes: file_temporal_server_api_enums_v1_cluster_proto_goTypes,
227 > DependencyIndexes: file_temporal_server_api_enums_v1_cluster_proto_depIdxs,
228 > EnumInfos: file_temporal_server_api_enums_v1_cluster_proto_enumTypes,
229 > }.Build()
230 > File_temporal_server_api_enums_v1_cluster_proto = out.File
231 > file_temporal_server_api_enums_v1_cluster_proto_goTypes = nil
232 > file_temporal_server_api_enums_v1_cluster_proto_depIdxs = nil
233 }
go.temporal.io/server/api/enums/v1/dlq.pb.go 20 covered LOC · 2 ranges

Open complete file

187 }
188
189 > func init() { file_temporal_server_api_enums_v1_dlq_proto_init() } dlq.pb.go
190 > func file_temporal_server_api_enums_v1_dlq_proto_init() {
191 > if File_temporal_server_api_enums_v1_dlq_proto != nil {
192 return
193 }
194 > type x struct{} dlq.pb.go
195 > out := protoimpl.TypeBuilder{
196 > File: protoimpl.DescBuilder{
197 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
198 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_dlq_proto_rawDesc), len(file_temporal_server_api_enums_v1_dlq_proto_rawDesc)),
199 > NumEnums: 2,
200 > NumMessages: 0,
201 > NumExtensions: 0,
202 > NumServices: 0,
203 > },
204 > GoTypes: file_temporal_server_api_enums_v1_dlq_proto_goTypes,
205 > DependencyIndexes: file_temporal_server_api_enums_v1_dlq_proto_depIdxs,
206 > EnumInfos: file_temporal_server_api_enums_v1_dlq_proto_enumTypes,
207 > }.Build()
208 > File_temporal_server_api_enums_v1_dlq_proto = out.File
209 > file_temporal_server_api_enums_v1_dlq_proto_goTypes = nil
210 > file_temporal_server_api_enums_v1_dlq_proto_depIdxs = nil
211 }
go.temporal.io/server/api/enums/v1/fairness_state.pb.go 20 covered LOC · 2 ranges

Open complete file

123 }
124
125 > func init() { file_temporal_server_api_enums_v1_fairness_state_proto_init() } fairness_state.pb.go
126 > func file_temporal_server_api_enums_v1_fairness_state_proto_init() {
127 > if File_temporal_server_api_enums_v1_fairness_state_proto != nil {
128 return
129 }
130 > type x struct{} fairness_state.pb.go
131 > out := protoimpl.TypeBuilder{
132 > File: protoimpl.DescBuilder{
133 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
134 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_fairness_state_proto_rawDesc), len(file_temporal_server_api_enums_v1_fairness_state_proto_rawDesc)),
135 > NumEnums: 1,
136 > NumMessages: 0,
137 > NumExtensions: 0,
138 > NumServices: 0,
139 > },
140 > GoTypes: file_temporal_server_api_enums_v1_fairness_state_proto_goTypes,
141 > DependencyIndexes: file_temporal_server_api_enums_v1_fairness_state_proto_depIdxs,
142 > EnumInfos: file_temporal_server_api_enums_v1_fairness_state_proto_enumTypes,
143 > }.Build()
144 > File_temporal_server_api_enums_v1_fairness_state_proto = out.File
145 > file_temporal_server_api_enums_v1_fairness_state_proto_goTypes = nil
146 > file_temporal_server_api_enums_v1_fairness_state_proto_depIdxs = nil
147 }
go.temporal.io/server/api/enums/v1/replication.pb.go 20 covered LOC · 2 ranges

Open complete file

314 }
315
316 > func init() { file_temporal_server_api_enums_v1_replication_proto_init() } replication.pb.go
317 > func file_temporal_server_api_enums_v1_replication_proto_init() {
318 > if File_temporal_server_api_enums_v1_replication_proto != nil {
319 return
320 }
321 > type x struct{} replication.pb.go
322 > out := protoimpl.TypeBuilder{
323 > File: protoimpl.DescBuilder{
324 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
325 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_replication_proto_rawDesc), len(file_temporal_server_api_enums_v1_replication_proto_rawDesc)),
326 > NumEnums: 3,
327 > NumMessages: 0,
328 > NumExtensions: 0,
329 > NumServices: 0,
330 > },
331 > GoTypes: file_temporal_server_api_enums_v1_replication_proto_goTypes,
332 > DependencyIndexes: file_temporal_server_api_enums_v1_replication_proto_depIdxs,
333 > EnumInfos: file_temporal_server_api_enums_v1_replication_proto_enumTypes,
334 > }.Build()
335 > File_temporal_server_api_enums_v1_replication_proto = out.File
336 > file_temporal_server_api_enums_v1_replication_proto_goTypes = nil
337 > file_temporal_server_api_enums_v1_replication_proto_depIdxs = nil
338 }
go.temporal.io/server/api/errordetails/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

625 }
626
627 > func init() { file_temporal_server_api_errordetails_v1_message_proto_init() } message.pb.go
628 > func file_temporal_server_api_errordetails_v1_message_proto_init() {
629 > if File_temporal_server_api_errordetails_v1_message_proto != nil {
630 return
631 }
632 > type x struct{} message.pb.go
633 > out := protoimpl.TypeBuilder{
634 > File: protoimpl.DescBuilder{
635 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
636 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_errordetails_v1_message_proto_rawDesc), len(file_temporal_server_api_errordetails_v1_message_proto_rawDesc)),
637 > NumEnums: 0,
638 > NumMessages: 10,
639 > NumExtensions: 0,
640 > NumServices: 0,
641 > },
642 > GoTypes: file_temporal_server_api_errordetails_v1_message_proto_goTypes,
643 > DependencyIndexes: file_temporal_server_api_errordetails_v1_message_proto_depIdxs,
644 > MessageInfos: file_temporal_server_api_errordetails_v1_message_proto_msgTypes,
645 > }.Build()
646 > File_temporal_server_api_errordetails_v1_message_proto = out.File
647 > file_temporal_server_api_errordetails_v1_message_proto_goTypes = nil
648 > file_temporal_server_api_errordetails_v1_message_proto_depIdxs = nil
649 }
go.temporal.io/server/api/health/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

300 }
301
302 > func init() { file_temporal_server_api_health_v1_message_proto_init() } message.pb.go
303 > func file_temporal_server_api_health_v1_message_proto_init() {
304 > if File_temporal_server_api_health_v1_message_proto != nil {
305 return
306 }
307 > type x struct{} message.pb.go
308 > out := protoimpl.TypeBuilder{
309 > File: protoimpl.DescBuilder{
310 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
311 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_health_v1_message_proto_rawDesc), len(file_temporal_server_api_health_v1_message_proto_rawDesc)),
312 > NumEnums: 0,
313 > NumMessages: 3,
314 > NumExtensions: 0,
315 > NumServices: 0,
316 > },
317 > GoTypes: file_temporal_server_api_health_v1_message_proto_goTypes,
318 > DependencyIndexes: file_temporal_server_api_health_v1_message_proto_depIdxs,
319 > MessageInfos: file_temporal_server_api_health_v1_message_proto_msgTypes,
320 > }.Build()
321 > File_temporal_server_api_health_v1_message_proto = out.File
322 > file_temporal_server_api_health_v1_message_proto_goTypes = nil
323 > file_temporal_server_api_health_v1_message_proto_depIdxs = nil
324 }
go.temporal.io/server/api/historyservice/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

428 }
429
430 > func init() { file_temporal_server_api_historyservice_v1_service_proto_init() } service.pb.go
431 > func file_temporal_server_api_historyservice_v1_service_proto_init() {
432 > if File_temporal_server_api_historyservice_v1_service_proto != nil {
433 return
434 }
435 > file_temporal_server_api_historyservice_v1_request_response_proto_init() service.pb.go
436 > type x struct{}
437 > out := protoimpl.TypeBuilder{
438 > File: protoimpl.DescBuilder{
439 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
440 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_historyservice_v1_service_proto_rawDesc), len(file_temporal_server_api_historyservice_v1_service_proto_rawDesc)),
441 > NumEnums: 0,
442 > NumMessages: 0,
443 > NumExtensions: 0,
444 > NumServices: 1,
445 > },
446 > GoTypes: file_temporal_server_api_historyservice_v1_service_proto_goTypes,
447 > DependencyIndexes: file_temporal_server_api_historyservice_v1_service_proto_depIdxs,
448 > }.Build()
449 > File_temporal_server_api_historyservice_v1_service_proto = out.File
450 > file_temporal_server_api_historyservice_v1_service_proto_goTypes = nil
451 > file_temporal_server_api_historyservice_v1_service_proto_depIdxs = nil
452 }
go.temporal.io/server/api/matchingservice/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

250 }
251
252 > func init() { file_temporal_server_api_matchingservice_v1_service_proto_init() } service.pb.go
253 > func file_temporal_server_api_matchingservice_v1_service_proto_init() {
254 > if File_temporal_server_api_matchingservice_v1_service_proto != nil {
255 return
256 }
257 > file_temporal_server_api_matchingservice_v1_request_response_proto_init() service.pb.go
258 > type x struct{}
259 > out := protoimpl.TypeBuilder{
260 > File: protoimpl.DescBuilder{
261 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
262 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_matchingservice_v1_service_proto_rawDesc), len(file_temporal_server_api_matchingservice_v1_service_proto_rawDesc)),
263 > NumEnums: 0,
264 > NumMessages: 0,
265 > NumExtensions: 0,
266 > NumServices: 1,
267 > },
268 > GoTypes: file_temporal_server_api_matchingservice_v1_service_proto_goTypes,
269 > DependencyIndexes: file_temporal_server_api_matchingservice_v1_service_proto_depIdxs,
270 > }.Build()
271 > File_temporal_server_api_matchingservice_v1_service_proto = out.File
272 > file_temporal_server_api_matchingservice_v1_service_proto_goTypes = nil
273 > file_temporal_server_api_matchingservice_v1_service_proto_depIdxs = nil
274 }
go.temporal.io/server/api/metrics/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

104 }
105
106 > func init() { file_temporal_server_api_metrics_v1_message_proto_init() } message.pb.go
107 > func file_temporal_server_api_metrics_v1_message_proto_init() {
108 > if File_temporal_server_api_metrics_v1_message_proto != nil {
109 return
110 }
111 > type x struct{} message.pb.go
112 > out := protoimpl.TypeBuilder{
113 > File: protoimpl.DescBuilder{
114 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
115 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_metrics_v1_message_proto_rawDesc), len(file_temporal_server_api_metrics_v1_message_proto_rawDesc)),
116 > NumEnums: 0,
117 > NumMessages: 2,
118 > NumExtensions: 0,
119 > NumServices: 0,
120 > },
121 > GoTypes: file_temporal_server_api_metrics_v1_message_proto_goTypes,
122 > DependencyIndexes: file_temporal_server_api_metrics_v1_message_proto_depIdxs,
123 > MessageInfos: file_temporal_server_api_metrics_v1_message_proto_msgTypes,
124 > }.Build()
125 > File_temporal_server_api_metrics_v1_message_proto = out.File
126 > file_temporal_server_api_metrics_v1_message_proto_goTypes = nil
127 > file_temporal_server_api_metrics_v1_message_proto_depIdxs = nil
128 }
go.temporal.io/server/api/namespace/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

114 }
115
116 > func init() { file_temporal_server_api_namespace_v1_message_proto_init() } message.pb.go
117 > func file_temporal_server_api_namespace_v1_message_proto_init() {
118 > if File_temporal_server_api_namespace_v1_message_proto != nil {
119 return
120 }
121 > type x struct{} message.pb.go
122 > out := protoimpl.TypeBuilder{
123 > File: protoimpl.DescBuilder{
124 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
125 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_namespace_v1_message_proto_rawDesc), len(file_temporal_server_api_namespace_v1_message_proto_rawDesc)),
126 > NumEnums: 0,
127 > NumMessages: 1,
128 > NumExtensions: 0,
129 > NumServices: 0,
130 > },
131 > GoTypes: file_temporal_server_api_namespace_v1_message_proto_goTypes,
132 > DependencyIndexes: file_temporal_server_api_namespace_v1_message_proto_depIdxs,
133 > MessageInfos: file_temporal_server_api_namespace_v1_message_proto_msgTypes,
134 > }.Build()
135 > File_temporal_server_api_namespace_v1_message_proto = out.File
136 > file_temporal_server_api_namespace_v1_message_proto_goTypes = nil
137 > file_temporal_server_api_namespace_v1_message_proto_depIdxs = nil
138 }
go.temporal.io/server/api/persistence/v1/chasm_visibility.pb.go 20 covered LOC · 2 ranges

Open complete file

146 }
147
148 > func init() { file_temporal_server_api_persistence_v1_chasm_visibility_proto_init() } chasm_visibility.pb.go
149 > func file_temporal_server_api_persistence_v1_chasm_visibility_proto_init() {
150 > if File_temporal_server_api_persistence_v1_chasm_visibility_proto != nil {
151 return
152 }
153 > type x struct{} chasm_visibility.pb.go
154 > out := protoimpl.TypeBuilder{
155 > File: protoimpl.DescBuilder{
156 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
157 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_chasm_visibility_proto_rawDesc), len(file_temporal_server_api_persistence_v1_chasm_visibility_proto_rawDesc)),
158 > NumEnums: 0,
159 > NumMessages: 2,
160 > NumExtensions: 0,
161 > NumServices: 0,
162 > },
163 > GoTypes: file_temporal_server_api_persistence_v1_chasm_visibility_proto_goTypes,
164 > DependencyIndexes: file_temporal_server_api_persistence_v1_chasm_visibility_proto_depIdxs,
165 > MessageInfos: file_temporal_server_api_persistence_v1_chasm_visibility_proto_msgTypes,
166 > }.Build()
167 > File_temporal_server_api_persistence_v1_chasm_visibility_proto = out.File
168 > file_temporal_server_api_persistence_v1_chasm_visibility_proto_goTypes = nil
169 > file_temporal_server_api_persistence_v1_chasm_visibility_proto_depIdxs = nil
170 }
go.temporal.io/server/api/persistence/v1/cluster_metadata.pb.go 20 covered LOC · 2 ranges

Open complete file

289 }
290
291 > func init() { file_temporal_server_api_persistence_v1_cluster_metadata_proto_init() } cluster_metadata.pb.go
292 > func file_temporal_server_api_persistence_v1_cluster_metadata_proto_init() {
293 > if File_temporal_server_api_persistence_v1_cluster_metadata_proto != nil {
294 return
295 }
296 > type x struct{} cluster_metadata.pb.go
297 > out := protoimpl.TypeBuilder{
298 > File: protoimpl.DescBuilder{
299 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
300 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_cluster_metadata_proto_rawDesc), len(file_temporal_server_api_persistence_v1_cluster_metadata_proto_rawDesc)),
301 > NumEnums: 0,
302 > NumMessages: 5,
303 > NumExtensions: 0,
304 > NumServices: 0,
305 > },
306 > GoTypes: file_temporal_server_api_persistence_v1_cluster_metadata_proto_goTypes,
307 > DependencyIndexes: file_temporal_server_api_persistence_v1_cluster_metadata_proto_depIdxs,
308 > MessageInfos: file_temporal_server_api_persistence_v1_cluster_metadata_proto_msgTypes,
309 > }.Build()
310 > File_temporal_server_api_persistence_v1_cluster_metadata_proto = out.File
311 > file_temporal_server_api_persistence_v1_cluster_metadata_proto_goTypes = nil
312 > file_temporal_server_api_persistence_v1_cluster_metadata_proto_depIdxs = nil
313 }
go.temporal.io/server/api/persistence/v1/history_tree.pb.go 20 covered LOC · 2 ranges

Open complete file

274 }
275
276 > func init() { file_temporal_server_api_persistence_v1_history_tree_proto_init() } history_tree.pb.go
277 > func file_temporal_server_api_persistence_v1_history_tree_proto_init() {
278 > if File_temporal_server_api_persistence_v1_history_tree_proto != nil {
279 return
280 }
281 > type x struct{} history_tree.pb.go
282 > out := protoimpl.TypeBuilder{
283 > File: protoimpl.DescBuilder{
284 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
285 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_history_tree_proto_rawDesc), len(file_temporal_server_api_persistence_v1_history_tree_proto_rawDesc)),
286 > NumEnums: 0,
287 > NumMessages: 3,
288 > NumExtensions: 0,
289 > NumServices: 0,
290 > },
291 > GoTypes: file_temporal_server_api_persistence_v1_history_tree_proto_goTypes,
292 > DependencyIndexes: file_temporal_server_api_persistence_v1_history_tree_proto_depIdxs,
293 > MessageInfos: file_temporal_server_api_persistence_v1_history_tree_proto_msgTypes,
294 > }.Build()
295 > File_temporal_server_api_persistence_v1_history_tree_proto = out.File
296 > file_temporal_server_api_persistence_v1_history_tree_proto_goTypes = nil
297 > file_temporal_server_api_persistence_v1_history_tree_proto_depIdxs = nil
298 }
go.temporal.io/server/api/persistence/v1/namespaces.pb.go 20 covered LOC · 2 ranges

Open complete file

536 }
537
538 > func init() { file_temporal_server_api_persistence_v1_namespaces_proto_init() } namespaces.pb.go
539 > func file_temporal_server_api_persistence_v1_namespaces_proto_init() {
540 > if File_temporal_server_api_persistence_v1_namespaces_proto != nil {
541 return
542 }
543 > type x struct{} namespaces.pb.go
544 > out := protoimpl.TypeBuilder{
545 > File: protoimpl.DescBuilder{
546 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
547 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_namespaces_proto_rawDesc), len(file_temporal_server_api_persistence_v1_namespaces_proto_rawDesc)),
548 > NumEnums: 0,
549 > NumMessages: 8,
550 > NumExtensions: 0,
551 > NumServices: 0,
552 > },
553 > GoTypes: file_temporal_server_api_persistence_v1_namespaces_proto_goTypes,
554 > DependencyIndexes: file_temporal_server_api_persistence_v1_namespaces_proto_depIdxs,
555 > MessageInfos: file_temporal_server_api_persistence_v1_namespaces_proto_msgTypes,
556 > }.Build()
557 > File_temporal_server_api_persistence_v1_namespaces_proto = out.File
558 > file_temporal_server_api_persistence_v1_namespaces_proto_goTypes = nil
559 > file_temporal_server_api_persistence_v1_namespaces_proto_depIdxs = nil
560 }
go.temporal.io/server/api/persistence/v1/queue_metadata.pb.go 20 covered LOC · 2 ranges

Open complete file

105 }
106
107 > func init() { file_temporal_server_api_persistence_v1_queue_metadata_proto_init() } queue_metadata.pb.go
108 > func file_temporal_server_api_persistence_v1_queue_metadata_proto_init() {
109 > if File_temporal_server_api_persistence_v1_queue_metadata_proto != nil {
110 return
111 }
112 > type x struct{} queue_metadata.pb.go
113 > out := protoimpl.TypeBuilder{
114 > File: protoimpl.DescBuilder{
115 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
116 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_queue_metadata_proto_rawDesc), len(file_temporal_server_api_persistence_v1_queue_metadata_proto_rawDesc)),
117 > NumEnums: 0,
118 > NumMessages: 2,
119 > NumExtensions: 0,
120 > NumServices: 0,
121 > },
122 > GoTypes: file_temporal_server_api_persistence_v1_queue_metadata_proto_goTypes,
123 > DependencyIndexes: file_temporal_server_api_persistence_v1_queue_metadata_proto_depIdxs,
124 > MessageInfos: file_temporal_server_api_persistence_v1_queue_metadata_proto_msgTypes,
125 > }.Build()
126 > File_temporal_server_api_persistence_v1_queue_metadata_proto = out.File
127 > file_temporal_server_api_persistence_v1_queue_metadata_proto_goTypes = nil
128 > file_temporal_server_api_persistence_v1_queue_metadata_proto_depIdxs = nil
129 }
go.temporal.io/server/api/persistence/v1/tasks.pb.go 20 covered LOC · 2 ranges

Open complete file

846 }
847
848 > func init() { file_temporal_server_api_persistence_v1_tasks_proto_init() } tasks.pb.go
849 > func file_temporal_server_api_persistence_v1_tasks_proto_init() {
850 > if File_temporal_server_api_persistence_v1_tasks_proto != nil {
851 return
852 }
853 > type x struct{} tasks.pb.go
854 > out := protoimpl.TypeBuilder{
855 > File: protoimpl.DescBuilder{
856 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
857 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_tasks_proto_rawDesc), len(file_temporal_server_api_persistence_v1_tasks_proto_rawDesc)),
858 > NumEnums: 0,
859 > NumMessages: 8,
860 > NumExtensions: 0,
861 > NumServices: 0,
862 > },
863 > GoTypes: file_temporal_server_api_persistence_v1_tasks_proto_goTypes,
864 > DependencyIndexes: file_temporal_server_api_persistence_v1_tasks_proto_depIdxs,
865 > MessageInfos: file_temporal_server_api_persistence_v1_tasks_proto_msgTypes,
866 > }.Build()
867 > File_temporal_server_api_persistence_v1_tasks_proto = out.File
868 > file_temporal_server_api_persistence_v1_tasks_proto_goTypes = nil
869 > file_temporal_server_api_persistence_v1_tasks_proto_depIdxs = nil
870 }
go.temporal.io/server/api/visibilityservice/v1/request_response.pb.go 20 covered LOC · 2 ranges

Open complete file

402 }
403
404 > func init() { file_temporal_server_api_visibilityservice_v1_request_response_proto_init() } request_response.pb.go
405 > func file_temporal_server_api_visibilityservice_v1_request_response_proto_init() {
406 > if File_temporal_server_api_visibilityservice_v1_request_response_proto != nil {
407 return
408 }
409 > type x struct{} request_response.pb.go
410 > out := protoimpl.TypeBuilder{
411 > File: protoimpl.DescBuilder{
412 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
413 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_visibilityservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_visibilityservice_v1_request_response_proto_rawDesc)),
414 > NumEnums: 0,
415 > NumMessages: 5,
416 > NumExtensions: 0,
417 > NumServices: 0,
418 > },
419 > GoTypes: file_temporal_server_api_visibilityservice_v1_request_response_proto_goTypes,
420 > DependencyIndexes: file_temporal_server_api_visibilityservice_v1_request_response_proto_depIdxs,
421 > MessageInfos: file_temporal_server_api_visibilityservice_v1_request_response_proto_msgTypes,
422 > }.Build()
423 > File_temporal_server_api_visibilityservice_v1_request_response_proto = out.File
424 > file_temporal_server_api_visibilityservice_v1_request_response_proto_goTypes = nil
425 > file_temporal_server_api_visibilityservice_v1_request_response_proto_depIdxs = nil
426 }
go.temporal.io/server/chasm/lib/callback/gen/callbackpb/v1/tasks.pb.go 20 covered LOC · 2 ranges

Open complete file

148 }
149
150 > func init() { file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_init() } tasks.pb.go
151 > func file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_init() {
152 > if File_temporal_server_chasm_lib_callback_proto_v1_tasks_proto != nil {
153 return
154 }
155 > type x struct{} tasks.pb.go
156 > out := protoimpl.TypeBuilder{
157 > File: protoimpl.DescBuilder{
158 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
159 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_rawDesc), len(file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_rawDesc)),
160 > NumEnums: 0,
161 > NumMessages: 2,
162 > NumExtensions: 0,
163 > NumServices: 0,
164 > },
165 > GoTypes: file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_goTypes,
166 > DependencyIndexes: file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_depIdxs,
167 > MessageInfos: file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_msgTypes,
168 > }.Build()
169 > File_temporal_server_chasm_lib_callback_proto_v1_tasks_proto = out.File
170 > file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_goTypes = nil
171 > file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_depIdxs = nil
172 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

71 }
72
73 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_init() } service.pb.go
74 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_init() {
75 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto != nil {
76 return
77 }
78 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_init() service.pb.go
79 > type x struct{}
80 > out := protoimpl.TypeBuilder{
81 > File: protoimpl.DescBuilder{
82 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
83 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_rawDesc)),
84 > NumEnums: 0,
85 > NumMessages: 0,
86 > NumExtensions: 0,
87 > NumServices: 1,
88 > },
89 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_goTypes,
90 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_depIdxs,
91 > }.Build()
92 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto = out.File
93 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_goTypes = nil
94 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_depIdxs = nil
95 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/tasks.pb.go 20 covered LOC · 2 ranges

Open complete file

354 }
355
356 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_init() } tasks.pb.go
357 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_init() {
358 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto != nil {
359 return
360 }
361 > type x struct{} tasks.pb.go
362 > out := protoimpl.TypeBuilder{
363 > File: protoimpl.DescBuilder{
364 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
365 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_rawDesc)),
366 > NumEnums: 0,
367 > NumMessages: 7,
368 > NumExtensions: 0,
369 > NumServices: 0,
370 > },
371 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_goTypes,
372 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_depIdxs,
373 > MessageInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_msgTypes,
374 > }.Build()
375 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto = out.File
376 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_goTypes = nil
377 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_depIdxs = nil
378 }
go.temporal.io/server/chasm/lib/workflow/gen/workflowpb/v1/state.pb.go 20 covered LOC · 2 ranges

Open complete file

211 }
212
213 > func init() { file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_init() } state.pb.go
214 > func file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_init() {
215 > if File_temporal_server_chasm_lib_workflow_proto_v1_state_proto != nil {
216 return
217 }
218 > type x struct{} state.pb.go
219 > out := protoimpl.TypeBuilder{
220 > File: protoimpl.DescBuilder{
221 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
222 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_rawDesc), len(file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_rawDesc)),
223 > NumEnums: 0,
224 > NumMessages: 3,
225 > NumExtensions: 0,
226 > NumServices: 0,
227 > },
228 > GoTypes: file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_goTypes,
229 > DependencyIndexes: file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_depIdxs,
230 > MessageInfos: file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_msgTypes,
231 > }.Build()
232 > File_temporal_server_chasm_lib_workflow_proto_v1_state_proto = out.File
233 > file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_goTypes = nil
234 > file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_depIdxs = nil
235 }
go.temporal.io/server/chasm/lib/workflow/gen/workflowpb/v1/update_state.pb.go 20 covered LOC · 2 ranges

Open complete file

113 }
114
115 > func init() { file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_init() } update_state.pb.go
116 > func file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_init() {
117 > if File_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto != nil {
118 return
119 }
120 > type x struct{} update_state.pb.go
121 > out := protoimpl.TypeBuilder{
122 > File: protoimpl.DescBuilder{
123 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
124 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_rawDesc), len(file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_rawDesc)),
125 > NumEnums: 0,
126 > NumMessages: 1,
127 > NumExtensions: 0,
128 > NumServices: 0,
129 > },
130 > GoTypes: file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_goTypes,
131 > DependencyIndexes: file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_depIdxs,
132 > MessageInfos: file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_msgTypes,
133 > }.Build()
134 > File_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto = out.File
135 > file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_goTypes = nil
136 > file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_depIdxs = nil
137 }
go.temporal.io/server/common/util/wildcard.go 20 covered LOC · 7 ranges

Open complete file

18 // WildCardStringToRegexps converts a given slices of string patterns to a slice of regular expressions matching
19 // wildcards (*) with any substring.
20 > func WildCardStringsToRegexp(patterns []string) (*regexp.Regexp, error) { wildcard.go
21 > var result strings.Builder
22 > result.WriteRune('^')
23 > for i, pattern := range patterns {
24 > result.WriteRune('(')
25 > first := true
26 > for literal := range strings.SplitSeq(pattern, "*") {
27 > if !first {
28 // Replace * with .*
29 result.WriteString(".*")
30 }
31 > result.WriteString(regexp.QuoteMeta(literal)) wildcard.go
32 > first = false
33 }
34 > result.WriteRune(')') wildcard.go
35 > if i < len(patterns)-1 {
36 > result.WriteRune('|') wildcard.go
37 > }
38 }
39 > result.WriteRune('$') wildcard.go
40 > return regexp.Compile(result.String())
41 }
42
43 // MustWildCardStringsToRegexp is like WildCardStringsToRegexp but panics on error.
44 > func MustWildCardStringsToRegexp(patterns []string) *regexp.Regexp { wildcard.go
45 > re, err := WildCardStringsToRegexp(patterns)
46 > if err != nil {
47 panic(err) //nolint:forbidigo // Must* functions conventionally panic on error.
48 }
49 > return re wildcard.go
50 }
go.temporal.io/server/common/namespace/registry_mock.go 19 covered LOC · 4 ranges

Open complete file

30
31 // NewMockRegistry creates a new mock instance.
32 > func NewMockRegistry(ctrl *gomock.Controller) *MockRegistry { registry_mock.go
33 > mock := &MockRegistry{ctrl: ctrl}
34 > mock.recorder = &MockRegistryMockRecorder{mock}
35 > return mock
36 > }
37
38 // EXPECT returns an object that allows the caller to indicate expected use.
39 > func (m *MockRegistry) EXPECT() *MockRegistryMockRecorder { registry_mock.go
40 > return m.recorder
41 > }
42
43 // GetAllNamespaces mocks base method.
86
87 // GetNamespaceByID mocks base method.
88 > func (m *MockRegistry) GetNamespaceByID(id ID) (*Namespace, error) { registry_mock.go
89 > m.ctrl.T.Helper()
90 > ret := m.ctrl.Call(m, "GetNamespaceByID", id)
91 > ret0, _ := ret[0].(*Namespace)
92 > ret1, _ := ret[1].(error)
93 > return ret0, ret1
94 > }
95
96 // GetNamespaceByID indicates an expected call of GetNamespaceByID.
97 > func (mr *MockRegistryMockRecorder) GetNamespaceByID(id any) *gomock.Call { registry_mock.go
98 > mr.mock.ctrl.T.Helper()
99 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNamespaceByID", reflect.TypeOf((*MockRegistry)(nil).GetNamespaceByID), id)
100 > }
101
102 // GetNamespaceByIDWithOptions mocks base method.
go.temporal.io/server/common/dynamicconfig/collection.go 18 covered LOC · 3 ranges

Open complete file

676 // treat the fields independently), or the zero value of its type (if you want to treat the fields
677 // as a group and default unset fields to zero).
678 > func ConvertStructure[T any](def T) func(v any) (T, error) { collection.go
679 > return func(v any) (T, error) {
680 > // if we already have the right type, no conversion is necessary
681 > if typedV, ok := v.(T); ok {
682 return typedV, nil
683 }
685 // Deep-copy the default and decode over it. This allows using e.g. a struct with some
686 // default fields filled in and a config that only set some fields.
687 > out := deepCopyForMapstructure(def) collection.go
688 >
689 > dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
690 > Result: &out,
691 > DecodeHook: mapstructure.ComposeDecodeHookFunc(
692 > mapstructureHookDuration,
693 > mapstructureHookTimestamp,
694 > mapstructureHookProtoEnum,
695 > mapstructureHookGeneric,
696 > ),
697 > })
698 > if err != nil {
699 return out, err
700 }
701 > err = dec.Decode(v) collection.go
702 > return out, err
703 }
704 }
go.temporal.io/server/common/namespace/replication_resolver.go 15 covered LOC · 2 ranges

Open complete file

49 }
50
51 > func NewDefaultReplicationResolverFactory() ReplicationResolverFactory { replication_resolver.go
52 > return func(detail *persistencespb.NamespaceDetail) ReplicationResolver {
53 > // By convention, a namespace with non-zero failover version is a global namespace
54 > // This can be overridden by WithGlobalFlag mutation if needed
55 > isGlobal := detail.FailoverVersion != 0
56 > return &defaultReplicationResolver{
57 > replicationConfig: detail.ReplicationConfig,
58 > isGlobalNamespace: isGlobal,
59 > failoverVersion: detail.FailoverVersion,
60 > failoverNotificationVersion: detail.FailoverNotificationVersion,
61 > }
62 > }
63 }
64
112 }
113
114 > func (r *defaultReplicationResolver) SetGlobalFlag(isGlobal bool) { replication_resolver.go
115 > r.isGlobalNamespace = isGlobal
116 > }
117
118 func (r *defaultReplicationResolver) SetActiveCluster(clusterName string) {
go.temporal.io/server/common/nexus/payload_serializer.go 15 covered LOC · 8 ranges

Open complete file

98
99 // Serialize implements nexus.Serializer.
100 > func (payloadSerializer) Serialize(v any) (*nexus.Content, error) { payload_serializer.go
101 > if v == nil {
102 // Use same structure as the nil serializer from the Nexus Go SDK.
103 return &nexus.Content{Header: nexus.Header{}}, nil
104 }
105 > payload, ok := v.(*commonpb.Payload) payload_serializer.go
106 > if !ok {
107 return nil, fmt.Errorf("%w: cannot serialize %v", errSerializer, v)
108 }
109
110 // Use the "nil" Nexus Content representation for nil Payloads.
111 > if payload == nil { payload_serializer.go
112 // Use same structure as the nil serializer from the Nexus Go SDK.
113 return &nexus.Content{Header: nexus.Header{}}, nil
114 }
115
116 > if len(payload.GetMetadata()) == 0 { payload_serializer.go
117 return xTemporalPayload(payload)
118 }
119
120 > content := nexus.Content{Header: nexus.Header{}, Data: payload.Data} payload_serializer.go
121 > encoding := string(payload.Metadata["encoding"])
122 > messageType := string(payload.Metadata["messageType"])
123 >
124 > switch encoding {
125 case "unknown/nexus-content":
126 for k, v := range payload.Metadata {
139 }
140 content.Header["type"] = fmt.Sprintf("application/x-protobuf; message-type=%q", messageType)
141 > case "json/plain": payload_serializer.go
142 > if len(payload.Metadata) != 1 {
143 return xTemporalPayload(payload)
144 }
145 > content.Header["type"] = "application/json" payload_serializer.go
146 case "binary/null":
147 if len(payload.Metadata) != 1 {
go.temporal.io/server/common/persistence/visibility/store/sql/query_converter_util_legacy.go 15 covered LOC · 3 ranges

Open complete file

68 }
69
70 > func newColName(name string) *colName { query_converter_util_legacy.go
71 > return &colName{Name: name}
72 > }
73
74 func newSAColName(
77 fieldName string,
78 valueType enumspb.IndexedValueType,
79 > ) *saColName { query_converter_util_legacy.go
80 > return &saColName{
81 > dbColName: newColName(dbColName),
82 > alias: alias,
83 > fieldName: fieldName,
84 > valueType: valueType,
85 > }
86 > }
87
88 func newFuncExpr(name string, exprs ...sqlparser.Expr) *sqlparser.FuncExpr {
105 }
106
107 > func getMaxDatetimeValue() time.Time { query_converter_util_legacy.go
108 > t, _ := time.Parse(time.RFC3339, "9999-12-31T23:59:59Z")
109 > return t
110 > }
111
112 // formatComparisonExprStringForError formats comparison expression after
go.temporal.io/server/service/history/hsm/sm.go 15 covered LOC · 4 ranges

Open complete file

41 // NewTransition creates a new [Transition] from the given source states to a destination state for a given event.
42 // The apply function is called after verifying the transition is possible and setting the destination state.
43 > func NewTransition[S comparable, SM StateMachine[S], E any](src []S, dst S, apply func(SM, E) (TransitionOutput, error)) Transition[S, SM, E] { sm.go
44 > return Transition[S, SM, E]{
45 > Sources: src,
46 > Destination: dst,
47 > apply: apply,
48 > }
49 > }
50
51 // Possible returns a boolean indicating whether the transition is possible for the current state.
52 > func (t Transition[S, SM, E]) Possible(sm SM) bool { sm.go
53 > return slices.Contains(t.Sources, sm.State())
54 > }
55
56 // Apply applies a transition event to the given state machine changing the state machine's state to the transition's
57 // Destination on success.
58 > func (t Transition[S, SM, E]) Apply(sm SM, event E) (TransitionOutput, error) { sm.go
59 > prevState := sm.State()
60 > if !t.Possible(sm) {
61 return TransitionOutput{}, fmt.Errorf("%w from %v: %v", ErrInvalidTransition, prevState, event)
62 }
63
64 > sm.SetState(t.Destination) sm.go
65 > return t.apply(sm, event)
66 }
go.temporal.io/server/common/build/build.go 14 covered LOC · 2 ranges

Open complete file

27 )
28
29 > func init() { build.go
30 > buildInfo, ok := debug.ReadBuildInfo()
31 > if !ok {
32 return
33 }
34
35 > InfoData.Available = true build.go
36 > InfoData.GoVersion = buildInfo.GoVersion
37 >
38 > for _, setting := range buildInfo.Settings {
39 > switch setting.Key {
40 > case "GOARCH":
41 > InfoData.GoArch = setting.Value
42 > case "GOOS":
43 > InfoData.GoOs = setting.Value
44 > case "CGO_ENABLED":
45 > InfoData.CgoEnabled = setting.Value == "1"
46 case "vcs.revision":
47 InfoData.GitRevision = setting.Value
go.temporal.io/server/common/dynamicconfig/gradual_change.go 14 covered LOC · 3 ranges

Open complete file

25 // StaticGradualChange returns a GradualChange whose Value always returns def and whose When
26 // always returns a time in the past.
27 > func StaticGradualChange[T any](def T) GradualChange[T] { gradual_change.go
28 > return GradualChange[T]{New: def}
29 > }
30
31 // Value returns the value for the given key at the given time.
56 // of type GradualChange into a GradualChange.
57 // nolint:revive // cognitive-complexity // this looks complicated but each case is fairly simple
58 > func ConvertGradualChange[T any](def T) func(v any) (GradualChange[T], error) { gradual_change.go
59 > changeConverter := ConvertStructure(StaticGradualChange(def))
60 >
61 > // Call this once so that if it's going to panic, it panics at static init time.
62 > _, _ = changeConverter(nil)
63 >
64 > switch reflect.TypeFor[T]() {
65 > case reflect.TypeFor[bool]():
66 > return func(v any) (GradualChange[T], error) {
67 if b, err := convertBool(v); err == nil {
68 var change GradualChange[T]
72 return changeConverter(v)
73 }
74 > case reflect.TypeFor[int](): gradual_change.go
75 > return func(v any) (GradualChange[T], error) {
76 if i, err := convertInt(v); err == nil {
77 var change GradualChange[T]
go.temporal.io/server/common/dynamicconfig/shared_structure.go 13 covered LOC · 5 ranges

Open complete file

17 )
18
19 > func warnDefaultSharedStructure(key string, def any) { shared_structure.go
20 > if path := hasSharedStructure(reflect.ValueOf(def), "root"); path != "" {
21 sharedStructureWarnings.Store(key, path)
22 }
42 }
43
44 > func hasSharedStructure(v reflect.Value, path string) string { shared_structure.go
45 > // nolint:exhaustive // deliberately not exhaustive
46 > switch v.Kind() {
47 > case reflect.Map, reflect.Slice, reflect.Pointer:
48 > if !v.IsNil() {
49 return path
50 }
51 > case reflect.Interface: shared_structure.go
52 > if !v.IsNil() {
53 return hasSharedStructure(v.Elem(), path)
54 }
55 > case reflect.Struct: shared_structure.go
56 > for i := range v.NumField() {
57 > if p := hasSharedStructure(v.Field(i), path+"."+v.Type().Field(i).Name); p != "" {
58 return p
59 }
go.temporal.io/server/common/metrics/defs_base.go 13 covered LOC · 2 ranges

Open complete file

10 }
11
12 > func newMetricDefinition(name string, opts ...Option) metricDefinition { defs_base.go
13 > d := metricDefinition{
14 > name: name,
15 > description: "",
16 > unit: "",
17 > }
18 > for _, opt := range opts {
19 > opt.apply(&d)
20 > }
21 > return d
22 }
23
24 > func (md metricDefinition) Name() string { defs_base.go
25 > return md.name
26 > }
27
28 func (md metricDefinition) Unit() MetricUnit {
go.temporal.io/server/common/nexus/callback_token.go 13 covered LOC · 4 ranges

Open complete file

33 }
34
35 > func NewCallbackTokenGenerator() *CallbackTokenGenerator { callback_token.go
36 > return &CallbackTokenGenerator{}
37 > }
38
39 > func (g *CallbackTokenGenerator) Tokenize(completion *tokenspb.NexusOperationCompletion) (string, error) { callback_token.go
40 > b, err := proto.Marshal(completion)
41 > if err != nil {
42 return "", err
43 }
44 > token := CallbackToken{ callback_token.go
45 > Version: TokenVersion,
46 > Data: base64.URLEncoding.EncodeToString(b),
47 > }
48 > b, err = json.Marshal(token)
49 > if err != nil {
50 return "", err
51 }
52 > return string(b), nil callback_token.go
53 }
54
go.temporal.io/server/common/persistence/visibility/store/elasticsearch/visibility_store.go 12 covered LOC · 3 ranges

Open complete file

101 }
102
103 > defaultSorter = func() []elastic.Sorter { visibility_store.go
104 > ret := make([]elastic.Sorter, 0, len(defaultSorterFields))
105 > for _, item := range defaultSorterFields {
106 > fs := elastic.NewFieldSort(item.name)
107 > if item.desc {
108 > fs.Desc()
109 > }
110 > if item.missing_first {
111 > fs.Missing("_first")
112 > } else {
113 fs.Missing("_last")
114 }
115 > ret = append(ret, fs) visibility_store.go
116 }
117 > return ret visibility_store.go
118 }()
119
go.temporal.io/server/common/log/tag/zap_tag.go 10 covered LOC · 2 ranges

Open complete file

44 }
45
46 > func NewStringTag(key string, value string) ZapTag { zap_tag.go
47 > return ZapTag{
48 > field: zap.String(key, value),
49 > }
50 > }
51
52 func NewStringsTag(key string, value []string) ZapTag {
118 }
119
120 > func NewBoolTag(key string, value bool) ZapTag { zap_tag.go
121 > return ZapTag{
122 > field: zap.Bool(key, value),
123 > }
124 > }
125
126 func NewErrorTag(key string, value error) ZapTag {
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/plugin.go 10 covered LOC · 1 range

Open complete file

36 var _ sqlplugin.Plugin = (*plugin)(nil)
37
38 > func init() { plugin.go
39 > sql.RegisterPlugin(PluginName, &plugin{
40 > driver: &driver.PQDriver{},
41 > queryConverter: &queryConverter{},
42 > })
43 > sql.RegisterPlugin(PluginNamePGX, &plugin{
44 > driver: &driver.PGXDriver{},
45 > queryConverter: &queryConverter{},
46 > })
47 > }
48
49 func (p *plugin) GetVisibilityQueryConverter() sqlplugin.VisibilityQueryConverter {
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/visibility.go 10 covered LOC · 1 range

Open complete file

40 )
41
42 > func buildOnDuplicateKeyUpdate(fields ...string) string { visibility.go
43 > items := make([]string, len(fields))
44 > for i, field := range fields {
45 > items[i] = fmt.Sprintf("%s = excluded.%s", field, field)
46 > }
47 > return fmt.Sprintf(
48 > // The WHERE clause ensures that no update occurs if the version is behind the saved version.
49 > "ON CONFLICT (namespace_id, run_id) DO UPDATE SET %s WHERE executions_visibility.%s < EXCLUDED.%s",
50 > strings.Join(items, ", "), sqlplugin.VersionColumnName, sqlplugin.VersionColumnName,
51 > )
52 }
53
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/visibility.go 10 covered LOC · 1 range

Open complete file

42 )
43
44 > func buildOnDuplicateKeyUpdate(fields ...string) string { visibility.go
45 > items := make([]string, len(fields))
46 > for i, field := range fields {
47 > items[i] = fmt.Sprintf("%s = excluded.%s", field, field)
48 > }
49 > return fmt.Sprintf(
50 > // The WHERE clause ensures that no update occurs if the version is behind the saved version.
51 > "ON CONFLICT (namespace_id, run_id) DO UPDATE SET %s WHERE executions_visibility.%s < EXCLUDED.%s",
52 > strings.Join(items, ", "), sqlplugin.VersionColumnName, sqlplugin.VersionColumnName,
53 > )
54 }
55
go.temporal.io/server/common/persistence/sql/sqlplugin/visibility.go 10 covered LOC · 2 ranges

Open complete file

219 }
220
221 > func getDbFields() []string { visibility.go
222 > t := reflect.TypeFor[VisibilityRow]()
223 > dbFields := make([]string, t.NumField())
224 > for i := 0; i < t.NumField(); i++ {
225 > f := t.Field(i)
226 > dbFields[i] = f.Tag.Get("db")
227 > if dbFields[i] == "" {
228 > dbFields[i] = strcase.ToSnake(f.Name)
229 > }
230 }
231 > return dbFields visibility.go
232 }
233
go.temporal.io/server/common/persistence/visibility/store/query/util.go 10 covered LOC · 2 ranges

Open complete file

70 }
71
72 > func NewUnsafeSQLString(val string) *UnsafeSQLString { util.go
73 > return &UnsafeSQLString{Val: val}
74 > }
75
76 func NewColName(name string) *ColumnName {
78 }
79
80 > func NewSAColumn(alias string, fieldName string, valueType enumspb.IndexedValueType) *SAColumn { util.go
81 > return &SAColumn{
82 > Alias: alias,
83 > FieldName: fieldName,
84 > ValueType: valueType,
85 > }
86 > }
87
88 func NamespaceDivisionSAColumn() *SAColumn {
go.temporal.io/server/common/persistence/sql/sqlplugin/util.go 9 covered LOC · 2 ranges

Open complete file

5 )
6
7 > func appendPrefix(prefix string, fields []string) []string { util.go
8 > out := make([]string, len(fields))
9 > for i, field := range fields {
10 > out[i] = prefix + field
11 > }
12 > return out
13 }
14
15 > func BuildNamedPlaceholder(fields ...string) string { util.go
16 > return strings.Join(appendPrefix(":", fields), ", ")
17 > }
go.temporal.io/server/common/primitives/timestamp/duration.go 9 covered LOC · 3 ranges

Open complete file

26 }
27
28 > func DurationPtr(td time.Duration) *durationpb.Duration { duration.go
29 > return durationpb.New(td)
30 > }
31
32 func MinDurationPtr(d1 *durationpb.Duration, d2 *durationpb.Duration) *durationpb.Duration {
47 }
48
49 > func DurationFromDays(d int32) *durationpb.Duration { duration.go
50 > return durationMultipleOf(int64(d), time.Hour*24)
51 > }
52
53 > func durationMultipleOf(amt int64, mult time.Duration) *durationpb.Duration { duration.go
54 > return DurationPtr(time.Duration(amt) * mult)
55 > }
56
57 // ValidateAndCapProtoDuration validates protobuf durations for two conditions:
go.temporal.io/server/common/testing/testhooks/test_impl.go 9 covered LOC · 2 ranges

Open complete file

89 var keyCounter atomic.Int64
90
91 > func newKey[T any, S any]() Key[T, S] { test_impl.go
92 > var zero S
93 > var s ScopeType
94 > switch any(zero).(type) {
95 > case namespace.ID, namespace.Name:
96 > s = ScopeNamespace
97 > case global:
98 > s = ScopeGlobal
99 default:
100 panic("testhooks: unknown scope type")
101 }
102 > return Key[T, S]{id: keyCounter.Add(1), scopeType: s} test_impl.go
103 }
go.temporal.io/server/service/history/workflow/state_machine_definition.go 9 covered LOC · 3 ranges

Open complete file

25
26 // Serialize is a noop as Deserialize is not supported.
27 > func (stateMachineDefinition) Serialize(any) ([]byte, error) { state_machine_definition.go
28 > return nil, nil
29 > }
30
31 > func (stateMachineDefinition) Type() string { state_machine_definition.go
32 > return StateMachineType
33 > }
34
35 > func RegisterStateMachine(reg *hsm.Registry) error { state_machine_definition.go
36 > return reg.RegisterMachine(stateMachineDefinition{})
37 > }
go.temporal.io/server/common/namespace/mutate.go 8 covered LOC · 2 ranges

Open complete file

8 type mutationFunc func(*Namespace)
9
10 > func (f mutationFunc) apply(ns *Namespace) { mutate.go
11 > f(ns)
12 > }
13
14 // WithActiveCluster assigns the active cluster to a Namespace during a Clone
43
44 // WithGlobalFlag sets whether or not this Namespace is global.
45 > func WithGlobalFlag(b bool) Mutation { mutate.go
46 > return mutationFunc(
47 > func(ns *Namespace) {
48 > ns.replicationResolver.SetGlobalFlag(b)
49 > })
50 }
51
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/visibility.go 8 covered LOC · 1 range

Open complete file

73 )
74
75 > func buildOnDuplicateKeyUpdate(fields ...string) string { visibility.go
76 > items := make([]string, len(fields))
77 > for i, field := range fields {
78 > // This line is to ensure that no update occurs (for any column) if the version is behind the saved version.
79 > items[i] = fmt.Sprintf("%v = IF(%v < VALUES(%v), VALUES(%v), %v)",
80 > field, sqlplugin.VersionColumnName, sqlplugin.VersionColumnName, field, field)
81 > }
82 > return fmt.Sprintf("ON DUPLICATE KEY UPDATE %s", strings.Join(items, ", "))
83 }
84
go.temporal.io/server/chasm/statemachine.go 7 covered LOC · 1 range

Open complete file

34 // The apply function is called after verifying the transition is possible but before setting the destination state,
35 // so it can inspect the current (source) state.
36 > func NewTransition[S comparable, SM StateMachine[S], E any](src []S, dst S, apply func(SM, MutableContext, E) error) Transition[S, SM, E] { statemachine.go
37 > return Transition[S, SM, E]{
38 > Sources: src,
39 > Destination: dst,
40 > apply: apply,
41 > }
42 > }
43
44 // Possible returns a boolean indicating whether the transition is possible for the current state.
go.temporal.io/server/common/definition/workflow_key.go 7 covered LOC · 1 range

Open complete file

19 workflowID string,
20 runID string,
21 > ) WorkflowKey { workflow_key.go
22 > return WorkflowKey{
23 > NamespaceID: namespaceID,
24 > WorkflowID: workflowID,
25 > RunID: runID,
26 > }
27 > }
28
29 func (k *WorkflowKey) GetNamespaceID() string {
go.temporal.io/server/common/dynamicconfig/registry.go 7 covered LOC · 3 ranges

Open complete file

17 )
18
19 > func register(s GenericSetting) { registry.go
20 > if globalRegistry.queried.Load() {
21 panic("dynamicconfig.New*Setting must only be called from static initializers")
22 }
23 > if globalRegistry.settings == nil { registry.go
24 > globalRegistry.settings = make(map[Key]GenericSetting)
25 > }
26 > if globalRegistry.settings[s.Key()] != nil {
27 // nolint:forbidigo // only called during static initialization
28 panic(fmt.Sprintf("duplicate registration of dynamic config key: %q", s.Key().String()))
29 }
30 > globalRegistry.settings[s.Key()] = s registry.go
31 }
32
go.temporal.io/server/common/membership/grpc_resolver.go 7 covered LOC · 2 ranges

Open complete file

53 )
54
55 > func init() { grpc_resolver.go
56 > // This must be called in init to avoid race conditions.
57 > resolver.Register(&globalGrpcBuilder)
58 > }
59
60 // Most code should not use this, this is only exposed for code that has to recognize and use a
80 }
81
82 > func (m *grpcBuilder) Scheme() string { grpc_resolver.go
83 > return grpcResolverScheme
84 > }
85
86 func (m *grpcBuilder) getServiceResolver(u *url.URL) (ServiceResolver, error) {
go.temporal.io/server/common/util.go 7 covered LOC · 2 ranges

Open complete file

161
162 // CreatePersistenceClientRetryPolicy creates a retry policy for calls to persistence
163 > func CreatePersistenceClientRetryPolicy() backoff.RetryPolicy { util.go
164 > return backoff.NewExponentialRetryPolicy(persistenceClientRetryInitialInterval).
165 > WithMaximumAttempts(persistenceClientRetryMaxAttempts)
166 > }
167
168 // CreateFrontendClientRetryPolicy creates a retry policy for calls to frontend service
688
689 // CloneProto is a generic typed version of proto.Clone from proto.
690 > func CloneProto[T proto.Message](v T) T { util.go
691 > return proto.Clone(v).(T)
692 > }
693
694 func CloneProtoMap[K comparable, T proto.Message](src map[K]T) map[K]T {
go.temporal.io/server/service/history/workflow/task_generator_provider.go 7 covered LOC · 2 ranges

Open complete file

23 )
24
25 > func init() { task_generator_provider.go
26 > var defaultProvider TaskGeneratorProvider = new(taskGeneratorProviderImpl)
27 > populateTaskGeneratorProvider(defaultProvider)
28 > }
29
30 > func populateTaskGeneratorProvider(provider TaskGeneratorProvider) { task_generator_provider.go
31 > _taskGeneratorProvider.Store(&provider)
32 > }
33
34 func GetTaskGeneratorProvider() TaskGeneratorProvider {
go.temporal.io/server/common/metrics/option.go 6 covered LOC · 2 ranges

Open complete file

10 type WithDescription string
11
12 > func (h WithDescription) apply(m *metricDefinition) { option.go
13 > m.description = string(h)
14 > }
15
16 // WithUnit sets the unit of a metric. See NewBytesHistogramDef for an example.
17 type WithUnit MetricUnit
18
19 > func (h WithUnit) apply(m *metricDefinition) { option.go
20 > m.unit = MetricUnit(h)
21 > }
go.temporal.io/server/common/persistence/data_interfaces.go 6 covered LOC · 3 ranges

Open complete file

1408 // UnixMilliseconds returns t as a Unix time, the number of milliseconds elapsed since January 1, 1970 UTC.
1409 // It should be used for all CQL timestamp.
1410 > func UnixMilliseconds(t time.Time) int64 { data_interfaces.go
1411 > // Handling zero time separately because UnixNano is undefined for zero times.
1412 > if t.IsZero() {
1413 return 0
1414 }
1415
1416 > unixNano := t.UnixNano() data_interfaces.go
1417 > if unixNano < 0 {
1418 // Time is before January 1, 1970 UTC
1419 return 0
1420 }
1421 > return unixNano / int64(time.Millisecond) data_interfaces.go
1422 }
1423
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/translator/fixed_address_translator.go 6 covered LOC · 2 ranges

Open complete file

15 )
16
17 > func init() { fixed_address_translator.go
18 > RegisterTranslator(fixedTranslatorName, NewFixedAddressTranslatorPlugin())
19 > }
20
21 type FixedAddressTranslatorPlugin struct {
22 }
23
24 > func NewFixedAddressTranslatorPlugin() TranslatorPlugin { fixed_address_translator.go
25 > return &FixedAddressTranslatorPlugin{}
26 > }
27
28 // GetTranslator What gocql driver does is that it will connect to the first node in the list in configuration
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/plugin.go 6 covered LOC · 1 range

Open complete file

43 }
44
45 > func init() { plugin.go
46 > sql.RegisterPlugin(PluginName, &plugin{
47 > queryConverter: &queryConverter{},
48 > connPool: newConnPool(),
49 > })
50 > }
51
52 func (p *plugin) GetVisibilityQueryConverter() sqlplugin.VisibilityQueryConverter {
go.temporal.io/server/service/history/tasks/key.go 6 covered LOC · 1 range

Open complete file

35 }
36
37 > func NewKey(fireTime time.Time, taskID int64) Key { key.go
38 > return Key{
39 > FireTime: fireTime,
40 > TaskID: taskID,
41 > }
42 > }
43
44 func ValidateKey(key Key) error {
go.temporal.io/server/chasm/lib/nexusoperation/config.go 5 covered LOC · 1 range

Open complete file

160 }
161
162 > func (cfg RetryPolicyConfig) build() backoff.RetryPolicy { config.go
163 > return backoff.NewExponentialRetryPolicy(cfg.InitialInterval).
164 > WithMaximumInterval(cfg.MaxInterval).
165 > WithExpirationInterval(backoff.NoInterval)
166 > }
167
168 var defaultRetryPolicyConfig = RetryPolicyConfig{
go.temporal.io/server/common/metrics/registry.go 5 covered LOC · 1 range

Open complete file

43
44 // register adds a metric definition to the list of pending metric definitions. This method is thread-safe.
45 > func (c *registry) register(d metricDefinition) { registry.go
46 > c.Lock()
47 > defer c.Unlock()
48 > c.definitions = append(c.definitions, d)
49 > }
50
51 // buildCatalog builds a catalog from the list of pending metric definitions. It is safe to call this method multiple
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/plugin.go 5 covered LOC · 1 range

Open complete file

24 var _ sqlplugin.Plugin = (*plugin)(nil)
25
26 > func init() { plugin.go
27 > sql.RegisterPlugin(PluginName, &plugin{
28 > queryConverter: &queryConverter{},
29 > })
30 > }
31
32 func (p *plugin) GetVisibilityQueryConverter() sqlplugin.VisibilityQueryConverter {
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/conn_pool.go 5 covered LOC · 1 range

Open complete file

23 }
24
25 > func newConnPool() *connPool { conn_pool.go
26 > return &connPool{
27 > pool: make(map[string]entry),
28 > }
29 > }
30
31 // Allocate allocates the shared database in the pool or returns already exists instance with the same DSN. If instance
go.temporal.io/server/common/log/noop_logger.go 4 covered LOC · 2 ranges

Open complete file

10
11 // NewNoopLogger return a noopLogger
12 > func NewNoopLogger() *noopLogger { noop_logger.go
13 > return &noopLogger{}
14 > }
15
16 func (n *noopLogger) Debug(string, ...tag.Tag) {}
17 func (n *noopLogger) Info(string, ...tag.Tag) {}
18 func (n *noopLogger) Warn(string, ...tag.Tag) {}
19 > func (n *noopLogger) Error(string, ...tag.Tag) {} noop_logger.go
20 func (n *noopLogger) DPanic(string, ...tag.Tag) {}
21 func (n *noopLogger) Panic(string, ...tag.Tag) {}
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/typeconv.go 4 covered LOC · 2 ranges

Open complete file

33 }
34
35 > func getMinMySQLDateTime() time.Time { typeconv.go
36 > t, err := time.Parse(time.RFC3339, "1000-01-01T00:00:00Z")
37 > if err != nil {
38 return time.Unix(0, 0).UTC()
39 }
40 > return t.UTC() typeconv.go
41 }
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/typeconv.go 4 covered LOC · 2 ranges

Open complete file

35 }
36
37 > func getMinPostgreSQLDateTime() time.Time { typeconv.go
38 > t, err := time.Parse(time.RFC3339, "1000-01-01T00:00:00Z")
39 > if err != nil {
40 return time.Unix(0, 0).UTC()
41 }
42 > return t.UTC() typeconv.go
43 }
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/typeconv.go 4 covered LOC · 2 ranges

Open complete file

33 }
34
35 > func getMinSQLiteDateTime() time.Time { typeconv.go
36 > t, err := time.Parse(time.RFC3339, "1000-01-01T00:00:00Z")
37 > if err != nil {
38 return time.Unix(0, 0).UTC()
39 }
40 > return t.UTC() typeconv.go
41 }
go.temporal.io/server/common/util/util.go 4 covered LOC · 1 range

Open complete file

68
69 // InverseMap creates the inverse map, ie., for a key-value map, it builds the value-key map.
70 > func InverseMap[M ~map[K]V, K, V comparable](m M) map[V]K { util.go
71 > if m == nil {
72 > return nil
73 > }
74 invm := make(map[V]K, len(m))
75 for k, v := range m {
go.temporal.io/server/components/nexusoperations/config.go 4 covered LOC · 2 ranges

Open complete file

218 // when the receiver or the setting is nil (e.g. in tests that construct a bare Config). It is
219 // nil-receiver safe.
220 > func (c *Config) ResolvedMetricTagConfig() chasmnexus.NexusMetricTagConfig { config.go
221 > if c == nil || c.MetricTagConfig == nil {
222 > return chasmnexus.NexusMetricTagConfig{} config.go
223 > }
224 return c.MetricTagConfig()
225 }
go.temporal.io/server/api/persistence/v1/predicates.go-helpers.pb.go 3 covered LOC · 1 range

Open complete file

17
18 // Size returns the size of the object, in bytes, once serialized
19 > func (val *Predicate) Size() int { predicates.go-helpers.pb.go
20 > return proto.Size(val)
21 > }
22
23 // Equal returns whether two Predicate values are equivalent by recursively
go.temporal.io/server/chasm/library.go 3 covered LOC · 1 range

Open complete file

56 // tasks within the CHASM framework.
57 // The format of the returned FQN is: "libName.name"
58 > func FullyQualifiedName(libName, name string) string { library.go
59 > return libName + "." + name
60 > }
go.temporal.io/server/chasm/registrable_component.go 3 covered LOC · 1 range

Open complete file

203 // The generated ID is used to uniquely identify components and tasks within the CHASM framework. The same FQN will
204 // always produce the same ID.
205 > func GenerateTypeID(fqn string) uint32 { registrable_component.go
206 > return farm.Fingerprint32([]byte(fqn))
207 > }
208
209 // hasBusinessIDAlias returns true if the component has a businessID alias configured
go.temporal.io/server/common/dynamicconfig/key.go 3 covered LOC · 1 range

Open complete file

13 )
14
15 > func MakeKey(s string) Key { key.go
16 > return Key{handle: unique.Make(strings.ToLower(s))}
17 > }
18
19 func (k Key) String() string {
go.temporal.io/server/common/nexus/nexusrpc/failure_converter.go 3 covered LOC · 1 range

Open complete file

196 // [Failure] instances are converted to [FailureError] to allow access to the full failure metadata and details if
197 // available.
198 > func DefaultFailureConverter() FailureConverter { failure_converter.go
199 > return defaultFailureConverter
200 > }
201
202 func retryBehaviorAsOptionalBool(e *nexus.HandlerError) *bool {
go.temporal.io/server/common/nexus/nexustest/registry.go 3 covered LOC · 1 range

Open complete file

14 }
15
16 > func (f FakeEndpointRegistry) GetByID(ctx context.Context, endpointID string) (*persistencespb.NexusEndpointEntry, error) { registry.go
17 > return f.OnGetByID(ctx, endpointID)
18 > }
19
20 func (f FakeEndpointRegistry) GetByName(ctx context.Context, namespaceID namespace.ID, endpointName string) (*persistencespb.NexusEndpointEntry, error) {
go.temporal.io/server/common/nexus/util.go 3 covered LOC · 1 range

Open complete file

12 // FormatDuration converts a duration into a string representation in millisecond resolution.
13 // TODO: replace this with the version exported from the Nexus SDK
14 > func FormatDuration(d time.Duration) string { util.go
15 > return strconv.FormatInt(d.Milliseconds(), 10) + "ms"
16 > }
17
18 // ConvertLinksToProto converts Nexus SDK links to protobuf links.
go.temporal.io/server/common/payload/payload.go 3 covered LOC · 1 range

Open complete file

30 }
31
32 > func Encode(value any) (*commonpb.Payload, error) { payload.go
33 > return defaultDataConverter.ToPayload(value)
34 > }
35
36 func Decode(p *commonpb.Payload, valuePtr any) error {
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/translator/translator_plugin.go 3 covered LOC · 1 range

Open complete file

22 // RegisterPlugin adds an auth plugin to the plugin registry
23 // it is only safe to use from a package init function
24 > func RegisterTranslator(name string, plugin TranslatorPlugin) { translator_plugin.go
25 > translators[name] = plugin
26 > }
27
28 func LookupTranslator(name string) (TranslatorPlugin, error) {
go.temporal.io/server/common/persistence/persistence_rate_limited_clients.go 3 covered LOC · 1 range

Open complete file

go.temporal.io/server/common/persistence/sql/store.go 3 covered LOC · 2 ranges

Open complete file

19
20 // RegisterPlugin will register a SQL plugin
21 > func RegisterPlugin(pluginName string, plugin sqlplugin.Plugin) { store.go
22 > if _, ok := supportedPlugins[pluginName]; ok {
23 panic("plugin " + pluginName + " already registered")
24 }
25 > supportedPlugins[pluginName] = plugin store.go
26 }
27
go.temporal.io/server/common/tasks/priority.go 3 covered LOC · 1 range

Open complete file

77 func getPriority(
78 class, subClass Priority,
79 > ) Priority { priority.go
80 > return class | subClass
81 > }
go.temporal.io/server/service/history/tasks/category.go 3 covered LOC · 1 range

Open complete file

100 }
101
102 > func (c Category) Name() string { category.go
103 > return c.name
104 > }
105
106 func (c Category) Type() CategoryType {
go.temporal.io/server/common/metrics/metrics.go 2 covered LOC · 2 ranges

Open complete file

80 )
81
82 > func (c CounterFunc) Record(v int64, tags ...Tag) { c(v, tags...) } metrics.go
83 func (c GaugeFunc) Record(v float64, tags ...Tag) { c(v, tags...) }
84 > func (c TimerFunc) Record(v time.Duration, tags ...Tag) { c(v, tags...) } metrics.go
85 func (c HistogramFunc) Record(v int64, tags ...Tag) { c(v, tags...) }
go.temporal.io/server/common/persistence/client/fx.go 2 covered LOC · 1 range

Open complete file

224 }
225
226 > func managerProvider[T persistence.Closeable](newManagerFn func(Factory) (T, error)) func(Factory, fx.Lifecycle) (T, error) { fx.go
227 > return func(f Factory, lc fx.Lifecycle) (T, error) {
228 manager, err := newManagerFn(f) // passing receiver (Factory) as first argument.
229 if err != nil {
go.temporal.io/server/common/aggregate/noop_moving_window_average.go 1 covered LOC · 1 range

Open complete file

7 )
8
9 > func newNoopMovingWindowAverage() *noopMovingWindowAverage { return &noopMovingWindowAverage{} } noop_moving_window_average.go
10
11 func (a *noopMovingWindowAverage) Record(_ int64) {}
go.temporal.io/server/common/metrics/noop_impl.go 1 covered LOC · 1 range

Open complete file

15 )
16
17 > func newNoopMetricsHandler() *noopMetricsHandler { return &noopMetricsHandler{} } noop_impl.go
18
19 // WithTags creates a new MetricProvder with provided []Tag
go.temporal.io/server/common/persistence/noop_health_signal_aggregator.go 1 covered LOC · 1 range

Open complete file

11 )
12
13 > func newNoopSignalAggregator() *noopSignalAggregator { return &noopSignalAggregator{} } noop_health_signal_aggregator.go
14
15 func (a *noopSignalAggregator) Start() {}