cluster_metadata.go ×12

Frontier kind: Code frontier

unlabeled · c_54b3aec95f39

21 tests · 4771 LOC · 201 files · introduces 0 tests · 41 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges41 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
919 ranges4771 lines · 201 files · Browse complete extent
All tests (intent)
21 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: 41 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/cluster_metadata.go 41 introduced LOC · 12 ranges

Open complete file

173 ctx context.Context,
174 filter *sqlplugin.ClusterMembershipFilter,
175 > ) ([]sqlplugin.ClusterMembershipRow, error) { cluster_metadata.go
176 > var queryString strings.Builder
177 > var operands []any
178 > queryString.WriteString(templateGetClusterMembership)
179 > operands = append(operands, constMembershipPartition)
180 > queryString.WriteString(strconv.Itoa(len(operands)))
181 >
182 > if filter.HostIDEquals != nil {
183 queryString.WriteString(templateWithHostIDSuffix)
184 operands = append(operands, filter.HostIDEquals)
186 }
187
188 > if filter.RPCAddressEquals != "" { cluster_metadata.go
189 queryString.WriteString(templateWithRPCAddressSuffix)
190 operands = append(operands, filter.RPCAddressEquals)
192 }
193
194 > if filter.RoleEquals != p.All { cluster_metadata.go
195 queryString.WriteString(templateWithRoleSuffix)
196 operands = append(operands, filter.RoleEquals)
198 }
199
200 > if !filter.LastHeartbeatAfter.IsZero() { cluster_metadata.go
201 > queryString.WriteString(templateWithHeartbeatSinceSuffix)
202 > operands = append(operands, filter.LastHeartbeatAfter)
203 > queryString.WriteString(strconv.Itoa(len(operands)))
204 > }
205
206 > if !filter.RecordExpiryAfter.IsZero() { cluster_metadata.go
207 > queryString.WriteString(templateWithRecordExpirySuffix)
208 > operands = append(operands, filter.RecordExpiryAfter)
209 > queryString.WriteString(strconv.Itoa(len(operands)))
210 > }
211
212 > if !filter.SessionStartedAfter.IsZero() { cluster_metadata.go
213 queryString.WriteString(templateWithSessionStartSuffix)
214 operands = append(operands, filter.SessionStartedAfter)
216 }
217
218 > if filter.HostIDGreaterThan != nil { cluster_metadata.go
219 queryString.WriteString(templateWithHostIDGreaterSuffix)
220 operands = append(operands, filter.HostIDGreaterThan)
222 }
223
224 > queryString.WriteString(templateWithOrderBySessionStartSuffix) cluster_metadata.go
225 >
226 > if filter.MaxRecordCount > 0 {
227 queryString.WriteString(templateWithLimitSuffix)
228 operands = append(operands, filter.MaxRecordCount)
230 }
231
232 > compiledQryString := queryString.String() cluster_metadata.go
233 >
234 > var rows []sqlplugin.ClusterMembershipRow
235 > err := pdb.SelectContext(ctx, &rows,
236 > compiledQryString,
237 > operands...)
238 > if err != nil {
239 return nil, err
240 }
241 > for i := range rows { cluster_metadata.go
242 rows[i].SessionStart = pdb.converter.FromPostgreSQLDateTime(rows[i].SessionStart)
243 rows[i].LastHeartbeat = pdb.converter.FromPostgreSQLDateTime(rows[i].LastHeartbeat)
244 rows[i].RecordExpiry = pdb.converter.FromPostgreSQLDateTime(rows[i].RecordExpiry)
245 }
246 > return rows, nil cluster_metadata.go
247 }
248
250 ctx context.Context,
251 filter *sqlplugin.PruneClusterMembershipFilter,
252 > ) (sql.Result, error) { cluster_metadata.go
253 > return pdb.ExecContext(ctx,
254 > templatePruneStaleClusterMembership,
255 > constMembershipPartition,
256 > filter.PruneRecordsBefore,
257 > )
258 > }