visibility_store.go ×13

Frontier kind: Code frontier

unlabeled · c_e83e4f3d5119

7 tests · 2236 LOC · 95 files · introduces 0 tests · 35 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges35 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
381 ranges2236 lines · 95 files · Browse complete extent
All tests (intent)
7 testsBrowse 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.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

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

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

go.temporal.io/server/common/persistence/visibility/store/elasticsearch/visibility_store.go 35 introduced LOC · 13 ranges

Open complete file

1012 namespaceName namespace.Name,
1013 chasmMapper *chasm.VisibilitySearchAttributesMapper,
1014 > ) (*store.InternalExecutionInfo, error) { visibility_store.go
1015 > logParseError := func(fieldName string, fieldValue any, err error, docID string) error {
1016 metrics.ElasticsearchDocumentParseFailuresCount.With(s.metricsHandler).Record(1)
1017 return serviceerror.NewInternalf("unable to parse Elasticsearch document(%s) %q field value %q: %v", docID, fieldName, fieldValue, err)
1018 }
1019
1020 > var sourceMap map[string]any visibility_store.go
1021 > d := json.NewDecoder(bytes.NewReader(docSource))
1022 > // Very important line. See finishParseJSONValue bellow.
1023 > d.UseNumber()
1024 > if err := d.Decode(&sourceMap); err != nil {
1025 metrics.ElasticsearchDocumentParseFailuresCount.With(s.metricsHandler).Record(1)
1026 return nil, serviceerror.NewInternalf("unable to unmarshal JSON from Elasticsearch document(%s): %v", docID, err)
1027 }
1028
1029 > combinedTypeMap := store.CombineTypeMaps(saTypeMap, chasmMapper) visibility_store.go
1030 >
1031 > var (
1032 > isValidType bool
1033 > memo []byte
1034 > memoEncoding string
1035 > allSearchAttributes map[string]any
1036 > )
1037 > record := &store.InternalExecutionInfo{}
1038 > for fieldName, fieldValue := range sourceMap {
1039 > switch fieldName {
1040 case sadefs.NamespaceID,
1041 sadefs.VisibilityTaskKey:
1059 }
1060
1061 > fieldType, err := combinedTypeMap.GetType(fieldName) visibility_store.go
1062 > if err != nil {
1063 // Silently ignore ErrInvalidName because it indicates an unknown field in an Elasticsearch document.
1064 if errors.Is(err, sadefs.ErrInvalidName) {
1069 }
1070
1071 > fieldValueParsed, err := finishParseJSONValue(fieldValue, fieldType) visibility_store.go
1072 > if err != nil {
1073 return nil, logParseError(fieldName, fieldValue, err, docID)
1074 }
1075
1076 > switch fieldName { visibility_store.go
1077 case sadefs.WorkflowID:
1078 record.WorkflowID = fieldValueParsed.(string)
1091 case sadefs.TaskQueue:
1092 record.TaskQueue = fieldValueParsed.(string)
1093 > case sadefs.ExecutionStatus: visibility_store.go
1094 > status, err := enumspb.WorkflowExecutionStatusFromString(fieldValueParsed.(string))
1095 > if err != nil {
1096 return nil, logParseError(fieldName, fieldValueParsed.(string), err, docID)
1097 }
1098 > record.Status = status visibility_store.go
1099 case sadefs.HistoryLength:
1100 record.HistoryLength = fieldValueParsed.(int64)
1119 }
1120
1121 > var err error visibility_store.go
1122 > record.SearchAttributes, err = searchattribute.Encode(allSearchAttributes, &combinedTypeMap)
1123 > if err != nil {
1124 metrics.ElasticsearchDocumentParseFailuresCount.With(s.metricsHandler).Record(1)
1125 return nil, serviceerror.NewInternalf(
1130 }
1131
1132 > if memoEncoding != "" { visibility_store.go
1133 record.Memo = persistence.NewDataBlob(memo, memoEncoding)
1134 > } else if memo != nil { visibility_store.go
1135 metrics.ElasticsearchDocumentParseFailuresCount.With(s.metricsHandler).Record(1)
1136 return nil, serviceerror.NewInternalf(
1263 }
1264 if t == enumspb.INDEXED_VALUE_TYPE_DATETIME {
1265 > return time.Parse(time.RFC3339Nano, stringVal) visibility_store.go
1266 > }
1267 return stringVal, nil
1268 case enumspb.INDEXED_VALUE_TYPE_INT, enumspb.INDEXED_VALUE_TYPE_DOUBLE: