MCPcopy Create free account
hub / github.com/Permify/permify / callbackWithToken

Method callbackWithToken

internal/engines/bulk.go:436–463  ·  view source on GitHub ↗

callbackWithToken calls the callback with the appropriate entity/subject ID and continuous token. This method retrieves the correct request from the sorted list and generates the appropriate continuous token for pagination support. Parameters: - index: The index of the result in the sorted list

(index int)

Source from the content-addressed store, hash-verified

434// Parameters:
435// - index: The index of the result in the sorted list
436func (bc *BulkChecker) callbackWithToken(index int) {
437 requests := bc.getSortedRequests()
438
439 // Validate index bounds
440 if index >= len(requests) {
441 return
442 }
443
444 var id string
445 var ct string
446
447 // Extract ID and generate continuous token based on checker type
448 switch bc.typ {
449 case BulkCheckerTypeEntity:
450 id = requests[index].Request.GetEntity().GetId()
451 if index+1 < len(requests) {
452 ct = utils.NewContinuousToken(requests[index+1].Request.GetEntity().GetId()).Encode().String()
453 }
454 case BulkCheckerTypeSubject:
455 id = requests[index].Request.GetSubject().GetId()
456 if index+1 < len(requests) {
457 ct = utils.NewContinuousToken(requests[index+1].Request.GetSubject().GetId()).Encode().String()
458 }
459 }
460
461 // Call the user-provided callback
462 bc.callback(id, ct)
463}
464
465// Close properly cleans up resources and cancels all operations.
466// This method should be called when the BulkChecker is no longer needed

Callers 1

processResultMethod · 0.95

Calls 7

getSortedRequestsMethod · 0.95
NewContinuousTokenFunction · 0.92
StringMethod · 0.65
EncodeMethod · 0.65
GetIdMethod · 0.45
GetEntityMethod · 0.45
GetSubjectMethod · 0.45

Tested by

no test coverage detected