MCPcopy Create free account
hub / github.com/astercloud/aster / GetCheckpoints

Method GetCheckpoints

server/handlers/session.go:306–337  ·  view source on GitHub ↗

GetCheckpoints retrieves session checkpoints

(c *gin.Context)

Source from the content-addressed store, hash-verified

304
305// GetCheckpoints retrieves session checkpoints
306func (h *SessionHandler) GetCheckpoints(c *gin.Context) {
307 ctx := c.Request.Context()
308 sessionID := c.Param("id")
309
310 records, err := (*h.store).List(ctx, "checkpoints")
311 if err != nil {
312 c.JSON(http.StatusInternalServerError, gin.H{
313 "success": false,
314 "error": gin.H{
315 "code": "internal_error",
316 "message": "Failed to list checkpoints: " + err.Error(),
317 },
318 })
319 return
320 }
321
322 checkpoints := make([]*CheckpointRecord, 0)
323 for _, record := range records {
324 var checkpoint CheckpointRecord
325 if err := store.DecodeValue(record, &checkpoint); err != nil {
326 continue
327 }
328 if checkpoint.SessionID == sessionID {
329 checkpoints = append(checkpoints, &checkpoint)
330 }
331 }
332
333 c.JSON(http.StatusOK, gin.H{
334 "success": true,
335 "data": checkpoints,
336 })
337}
338
339// Resume resumes a session
340func (h *SessionHandler) Resume(c *gin.Context) {

Callers

nothing calls this directly

Calls 5

DecodeValueFunction · 0.92
JSONMethod · 0.80
ContextMethod · 0.65
ListMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected