visibility_archiver.go ×7

Frontier kind: Code frontier

unlabeled · c_9da7338af410

16 tests · 2086 LOC · 89 files · introduces 0 tests · 40 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges40 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
331 ranges2086 lines · 89 files · Browse complete extent
All tests (intent)
16 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.

2 files ranked by introduced lines: 40 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/archiver/s3store/visibility_archiver.go 28 introduced LOC · 7 ranges

Open complete file

90 request *archiverspb.VisibilityRecord,
91 opts ...archiver.ArchiveOption,
92 > ) (err error) { visibility_archiver.go
93 > handler := v.metricsHandler.WithTags(metrics.OperationTag(metrics.VisibilityArchiverScope), metrics.NamespaceTag(request.Namespace))
94 > featureCatalog := archiver.GetFeatureCatalog(opts...)
95 > startTime := time.Now().UTC()
96 > logger := archiver.TagLoggerWithArchiveVisibilityRequestAndURI(v.logger, request, URI.String())
97 > archiveFailReason := ""
98 > defer func() {
99 > metrics.ServiceLatency.With(handler).Record(time.Since(startTime))
100 > if err != nil {
101 if isRetryableError(err) {
102 metrics.VisibilityArchiverArchiveTransientErrorCount.With(handler).Record(1)
112 }()
113
114 > if err := SoftValidateURI(URI); err != nil { visibility_archiver.go
115 archiveFailReason = archiver.ErrReasonInvalidURI
116 return err
117 }
118
119 > if err := archiver.ValidateVisibilityArchivalRequest(request); err != nil { visibility_archiver.go
120 archiveFailReason = archiver.ErrReasonInvalidArchiveRequest
121 return err
122 }
123
124 > encodedVisibilityRecord, err := Encode(request) visibility_archiver.go
125 > if err != nil {
126 archiveFailReason = errEncodeVisibilityRecord
127 return err
128 }
129 > indexes := createIndexesToArchive(request) visibility_archiver.go
130 > // Upload archive to all indexes
131 > for _, element := range indexes {
132 > key := constructTimestampIndex(URI.Path(), request.GetNamespaceId(), element.primaryIndex, element.primaryIndexValue, element.secondaryIndex, element.secondaryIndexTimestamp, request.GetRunId())
133 > if err := Upload(ctx, v.s3cli, URI, key, encodedVisibilityRecord); err != nil {
134 archiveFailReason = errWriteKey
135 return err
136 }
137 }
138 > metrics.VisibilityArchiveSuccessCount.With(handler).Record(1) visibility_archiver.go
139 > return nil
140 }
141
142 > func createIndexesToArchive(request *archiverspb.VisibilityRecord) []indexToArchive { visibility_archiver.go
143 > return []indexToArchive{
144 > {primaryIndexKeyWorkflowTypeName, request.WorkflowTypeName, secondaryIndexKeyCloseTimeout, timestamp.TimeValue(request.CloseTime)},
145 > {primaryIndexKeyWorkflowTypeName, request.WorkflowTypeName, secondaryIndexKeyStartTimeout, timestamp.TimeValue(request.StartTime)},
146 > {primaryIndexKeyWorkflowID, request.GetWorkflowId(), secondaryIndexKeyCloseTimeout, timestamp.TimeValue(request.CloseTime)},
147 > {primaryIndexKeyWorkflowID, request.GetWorkflowId(), secondaryIndexKeyStartTimeout, timestamp.TimeValue(request.StartTime)},
148 > }
149 > }
150
151 func (v *visibilityArchiver) Query(
go.temporal.io/server/common/archiver/s3store/util.go 12 introduced LOC · 2 ranges

Open complete file

29 // encoding & decoding util
30
31 > func Encode(message proto.Message) ([]byte, error) { util.go
32 > encoder := codec.NewJSONPBEncoder()
33 > return encoder.Encode(message)
34 > }
35
36 func decodeVisibilityRecord(data []byte) (*archiverspb.VisibilityRecord, error) {
150 }
151
152 > func constructTimestampIndex(path, namespaceID, primaryIndexKey, primaryIndexValue, secondaryIndexKey string, secondaryIndexValue time.Time, runID string) string { util.go
153 > return fmt.Sprintf(
154 > "%s/%s/%s",
155 > constructIndexedVisibilitySearchPrefix(path, namespaceID, primaryIndexKey, primaryIndexValue, secondaryIndexKey),
156 > secondaryIndexValue.Format(time.RFC3339),
157 > runID,
158 > )
159 > }
160
161 func constructIndexedVisibilitySearchPrefix(