MCPcopy Index your code
hub / github.com/InferCore/InferCore / ListSteps

Method ListSteps

internal/requests/sqlite.go:179–214  ·  view source on GitHub ↗
(ctx context.Context, requestID string)

Source from the content-addressed store, hash-verified

177}
178
179func (s *sqliteStore) ListSteps(ctx context.Context, requestID string) ([]StepRow, error) {
180 rows, err := s.db.QueryContext(ctx, `
181SELECT request_id, step_index, step_type, input_json, output_json, backend, status, error, latency_ms, metadata_json
182FROM request_steps WHERE request_id = ? ORDER BY step_index ASC`, requestID)
183 if err != nil {
184 return nil, err
185 }
186 defer rows.Close()
187 var out []StepRow
188 for rows.Next() {
189 var srow StepRow
190 var inJ, outJ, metaJ sql.NullString
191 if err := rows.Scan(&srow.RequestID, &srow.StepIndex, &srow.StepType, &inJ, &outJ, &srow.Backend, &srow.Status, &srow.Error, &srow.LatencyMs, &metaJ); err != nil {
192 return nil, err
193 }
194 if inJ.Valid {
195 srow.InputJSON = []byte(inJ.String)
196 }
197 if outJ.Valid {
198 srow.OutputJSON = []byte(outJ.String)
199 }
200 if metaJ.Valid {
201 srow.MetadataJSON = []byte(metaJ.String)
202 }
203 out = append(out, srow)
204 }
205 if err := rows.Err(); err != nil {
206 return nil, err
207 }
208 if len(out) == 0 {
209 if _, err := s.GetRequest(ctx, requestID); err != nil {
210 return nil, err
211 }
212 }
213 return out, nil
214}
215
216func (s *sqliteStore) Close() error {
217 return s.db.Close()

Callers

nothing calls this directly

Calls 2

GetRequestMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected