MCPcopy Index your code
hub / github.com/dagger/dagger / debugSessionResultsSnapshot

Method debugSessionResultsSnapshot

dagql/cache_debug.go:184–215  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182}
183
184func (c *Cache) debugSessionResultsSnapshot() []CacheDebugSessionResults {
185 if c == nil {
186 return nil
187 }
188 c.sessionMu.Lock()
189 defer c.sessionMu.Unlock()
190 if len(c.sessionResultIDsBySession) == 0 {
191 return nil
192 }
193 sessionIDs := make([]string, 0, len(c.sessionResultIDsBySession))
194 for sessionID := range c.sessionResultIDsBySession {
195 sessionIDs = append(sessionIDs, sessionID)
196 }
197 slices.Sort(sessionIDs)
198 out := make([]CacheDebugSessionResults, 0, len(sessionIDs))
199 for _, sessionID := range sessionIDs {
200 resultIDs := c.sessionResultIDsBySession[sessionID]
201 if len(resultIDs) == 0 {
202 continue
203 }
204 sharedResultIDs := make([]uint64, 0, len(resultIDs))
205 for resultID := range resultIDs {
206 sharedResultIDs = append(sharedResultIDs, uint64(resultID))
207 }
208 slices.Sort(sharedResultIDs)
209 out = append(out, CacheDebugSessionResults{
210 SessionID: sessionID,
211 SharedResultIDs: sharedResultIDs,
212 })
213 }
214 return out
215}
216
217func (c *Cache) nextTraceSeq() uint64 {
218 return atomic.AddUint64(&c.traceSeq, 1)

Callers 1

Calls 1

SortMethod · 0.45

Tested by

no test coverage detected