cluster_metadata.go ×11

Frontier kind: Code frontier

unlabeled · c_c485d0fda372

53 tests · 3938 LOC · 182 files · introduces 0 tests · 36 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges36 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
705 ranges3938 lines · 182 files · Browse complete extent
All tests (intent)
53 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: 36 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/sql/cluster_metadata.go 36 introduced LOC · 11 ranges

Open complete file

129 ctx context.Context,
130 request *p.GetClusterMembersRequest,
131 > ) (*p.GetClusterMembersResponse, error) { cluster_metadata.go
132 > var lastSeenHostId []byte
133 > if len(request.NextPageToken) == 16 {
134 lastSeenHostId = request.NextPageToken
135 > } else if len(request.NextPageToken) > 0 { cluster_metadata.go
136 return nil, serviceerror.NewInternal("page token is corrupted.")
137 }
138
139 > now := time.Now().UTC() cluster_metadata.go
140 > filter := &sqlplugin.ClusterMembershipFilter{
141 > HostIDEquals: request.HostIDEquals,
142 > RoleEquals: request.RoleEquals,
143 > RecordExpiryAfter: now,
144 > SessionStartedAfter: request.SessionStartedAfter,
145 > MaxRecordCount: request.PageSize,
146 > }
147 >
148 > if lastSeenHostId != nil && filter.HostIDEquals == nil {
149 filter.HostIDGreaterThan = lastSeenHostId
150 }
151
152 > if request.LastHeartbeatWithin > 0 { cluster_metadata.go
153 > filter.LastHeartbeatAfter = now.Add(-request.LastHeartbeatWithin)
154 > }
155
156 > if request.RPCAddressEquals != nil { cluster_metadata.go
157 filter.RPCAddressEquals = request.RPCAddressEquals.String()
158 }
159
160 > rows, err := s.DB.GetClusterMembers(ctx, filter) cluster_metadata.go
161 >
162 > if err != nil {
163 return nil, convertCommonErrors("GetClusterMembers", err)
164 }
165
166 > convertedRows := make([]*p.ClusterMember, 0, len(rows)) cluster_metadata.go
167 > for _, row := range rows {
168 convertedRows = append(convertedRows, &p.ClusterMember{
169 HostID: row.HostID,
177 }
178
179 > var nextPageToken []byte cluster_metadata.go
180 > if request.PageSize > 0 && len(rows) == request.PageSize {
181 lastRow := rows[len(rows)-1]
182 nextPageToken = lastRow.HostID
183 }
184
185 > return &p.GetClusterMembersResponse{ActiveMembers: convertedRows, NextPageToken: nextPageToken}, nil cluster_metadata.go
186 }
187
211 ctx context.Context,
212 request *p.PruneClusterMembershipRequest,
213 > ) error { cluster_metadata.go
214 > _, err := s.DB.PruneClusterMembership(
215 > ctx,
216 > &sqlplugin.PruneClusterMembershipFilter{
217 > PruneRecordsBefore: time.Now().UTC(),
218 > },
219 > )
220 >
221 > if err != nil {
222 return convertCommonErrors("PruneClusterMembership", err)
223 }
224
225 > return nil cluster_metadata.go
226 }
227