MCPcopy Create free account
hub / github.com/cloudwego/eino-examples / parseBatchIndex

Function parseBatchIndex

compose/batch/batch/store.go:54–60  ·  view source on GitHub ↗

parseBatchIndex extracts the batch index from a checkpoint ID. Returns error if the ID format is invalid.

(checkPointID string)

Source from the content-addressed store, hash-verified

52// parseBatchIndex extracts the batch index from a checkpoint ID.
53// Returns error if the ID format is invalid.
54func parseBatchIndex(checkPointID string) (int, error) {
55 if !strings.HasPrefix(checkPointID, "batch_") {
56 return 0, fmt.Errorf("invalid batch checkpoint ID: %s", checkPointID)
57 }
58 indexStr := strings.TrimPrefix(checkPointID, "batch_")
59 return strconv.Atoi(indexStr)
60}
61
62// Get retrieves checkpoint data for a batch index.
63// Implements compose.CheckPointStore interface.

Callers 2

GetMethod · 0.85
SetMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected