workflow_handler.go ×19

Frontier kind: Joint frontier

unlabeled · c_46e8f9acf46d

1 test · 3914 LOC · 198 files · introduces 1 test · 84 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
19 ranges84 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
580 ranges3914 lines · 198 files · Browse complete extent
All tests (intent)
1 testBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 84 introduced LOC across 19 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/frontend/workflow_handler.go 84 introduced LOC · 19 ranges

Open complete file

2502
2503 // ListOpenWorkflowExecutions is a visibility API to list the open executions in a specific namespace.
2504 > func (wh *WorkflowHandler) ListOpenWorkflowExecutions(ctx context.Context, request *workflowservice.ListOpenWorkflowExecutionsRequest) (_ *workflowservice.ListOpenWorkflowExecutionsResponse, retError error) { workflow_handler.go
2505 > defer log.CapturePanic(wh.logger, &retError)
2506 >
2507 > if request == nil {
2508 return nil, errRequestNotSet
2509 }
2510
2511 > maxPageSize := int32(wh.config.VisibilityMaxPageSize(request.GetNamespace())) workflow_handler.go
2512 > if request.GetMaximumPageSize() <= 0 || request.GetMaximumPageSize() > maxPageSize {
2513 > request.MaximumPageSize = maxPageSize
2514 > }
2515
2516 > namespaceName := namespace.Name(request.GetNamespace()) workflow_handler.go
2517 > namespaceID, err := wh.namespaceRegistry.GetNamespaceID(namespaceName)
2518 > if err != nil {
2519 return nil, err
2520 }
2521
2522 > if request.StartTimeFilter == nil { workflow_handler.go
2523 request.StartTimeFilter = &filterpb.StartTimeFilter{}
2524 }
2525
2526 > earliestTime := request.StartTimeFilter.GetEarliestTime() workflow_handler.go
2527 > latestTime := request.StartTimeFilter.GetLatestTime()
2528 > query := []string{}
2529 >
2530 > query = append(query, fmt.Sprintf(
2531 > "%s = '%s'",
2532 > sadefs.ExecutionStatus,
2533 > enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
2534 > ))
2535 >
2536 > if earliestTime != nil && !earliestTime.AsTime().IsZero() &&
2537 > latestTime != nil && !latestTime.AsTime().IsZero() {
2538 if earliestTime.AsTime().After(latestTime.AsTime()) {
2539 return nil, errEarliestTimeIsGreaterThanLatestTime
2545 latestTime.AsTime().Format(time.RFC3339Nano),
2546 ))
2547 > } else if earliestTime != nil && !earliestTime.AsTime().IsZero() { workflow_handler.go
2548 query = append(query, fmt.Sprintf(
2549 "%s >= '%s'",
2551 earliestTime.AsTime().Format(time.RFC3339Nano),
2552 ))
2553 > } else if latestTime != nil && !latestTime.AsTime().IsZero() { workflow_handler.go
2554 > query = append(query, fmt.Sprintf(
2555 > "%s <= '%s'",
2556 > sadefs.StartTime,
2557 > latestTime.AsTime().Format(time.RFC3339Nano),
2558 > ))
2559 > }
2560
2561 > if request.GetExecutionFilter() != nil { workflow_handler.go
2562 > if wh.config.DisableListVisibilityByFilter(namespaceName.String()) {
2563 > return nil, errListNotAllowed
2564 > }
2565 query = append(query, fmt.Sprintf(
2566 "%s = '%s'",
2570 wh.logger.Debug("List open workflow with filter",
2571 tag.WorkflowNamespace(request.GetNamespace()), tag.WorkflowListWorkflowFilterByID)
2572 > } else if request.GetTypeFilter() != nil { workflow_handler.go
2573 > if wh.config.DisableListVisibilityByFilter(namespaceName.String()) {
2574 > return nil, errListNotAllowed
2575 > }
2576 query = append(query, fmt.Sprintf(
2577 "%s = '%s'",
2603
2604 // ListClosedWorkflowExecutions is a visibility API to list the closed executions in a specific namespace.
2605 > func (wh *WorkflowHandler) ListClosedWorkflowExecutions(ctx context.Context, request *workflowservice.ListClosedWorkflowExecutionsRequest) (_ *workflowservice.ListClosedWorkflowExecutionsResponse, retError error) { workflow_handler.go
2606 > defer log.CapturePanic(wh.logger, &retError)
2607 >
2608 > if request == nil {
2609 return nil, errRequestNotSet
2610 }
2611
2612 > maxPageSize := int32(wh.config.VisibilityMaxPageSize(request.GetNamespace())) workflow_handler.go
2613 > if request.GetMaximumPageSize() <= 0 || request.GetMaximumPageSize() > maxPageSize {
2614 > request.MaximumPageSize = maxPageSize
2615 > }
2616
2617 > namespaceName := namespace.Name(request.GetNamespace()) workflow_handler.go
2618 > namespaceID, err := wh.namespaceRegistry.GetNamespaceID(namespaceName)
2619 > if err != nil {
2620 return nil, err
2621 }
2622
2623 > if request.StartTimeFilter == nil { workflow_handler.go
2624 request.StartTimeFilter = &filterpb.StartTimeFilter{}
2625 }
2626
2627 > earliestTime := request.StartTimeFilter.GetEarliestTime() workflow_handler.go
2628 > latestTime := request.StartTimeFilter.GetLatestTime()
2629 > query := []string{}
2630 >
2631 > query = append(query, fmt.Sprintf(
2632 > "%s != '%s'",
2633 > sadefs.ExecutionStatus,
2634 > enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
2635 > ))
2636 >
2637 > if earliestTime != nil && !earliestTime.AsTime().IsZero() &&
2638 > latestTime != nil && !latestTime.AsTime().IsZero() {
2639 if earliestTime.AsTime().After(latestTime.AsTime()) {
2640 return nil, errEarliestTimeIsGreaterThanLatestTime
2646 latestTime.AsTime().Format(time.RFC3339Nano),
2647 ))
2648 > } else if earliestTime != nil && !earliestTime.AsTime().IsZero() { workflow_handler.go
2649 query = append(query, fmt.Sprintf(
2650 "%s >= '%s'",
2652 earliestTime.AsTime().Format(time.RFC3339Nano),
2653 ))
2654 > } else if latestTime != nil && !latestTime.AsTime().IsZero() { workflow_handler.go
2655 > query = append(query, fmt.Sprintf(
2656 > "%s <= '%s'",
2657 > sadefs.CloseTime,
2658 > latestTime.AsTime().Format(time.RFC3339Nano),
2659 > ))
2660 > }
2661
2662 > if request.GetExecutionFilter() != nil { workflow_handler.go
2663 > if wh.config.DisableListVisibilityByFilter(namespaceName.String()) {
2664 > return nil, errListNotAllowed
2665 > }
2666 query = append(query, fmt.Sprintf(
2667 "%s = '%s'",
2671 wh.logger.Debug("List closed workflow with filter",
2672 tag.WorkflowNamespace(request.GetNamespace()), tag.WorkflowListWorkflowFilterByID)
2673 > } else if request.GetTypeFilter() != nil { workflow_handler.go
2674 > if wh.config.DisableListVisibilityByFilter(namespaceName.String()) {
2675 > return nil, errListNotAllowed
2676 > }
2677 query = append(query, fmt.Sprintf(
2678 "%s = '%s'",
2682 wh.logger.Debug("List closed workflow with filter",
2683 tag.WorkflowNamespace(request.GetNamespace()), tag.WorkflowListWorkflowFilterByType)
2684 > } else if request.GetStatusFilter() != nil { workflow_handler.go
2685 > if wh.config.DisableListVisibilityByFilter(namespaceName.String()) {
2686 > return nil, errListNotAllowed
2687 > }
2688 if request.GetStatusFilter().GetStatus() == enumspb.WORKFLOW_EXECUTION_STATUS_UNSPECIFIED || request.GetStatusFilter().GetStatus() == enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING {
2689 return nil, errStatusFilterMustBeNotRunning