cluster_metadata.go ×12

Frontier kind: Code frontier

unlabeled · c_34e73c04b13d

7 tests · 4749 LOC · 201 files · introduces 0 tests · 39 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges39 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
911 ranges4749 lines · 201 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: 39 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

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

Open complete file

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