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

Method getSortedRequests

internal/engines/bulk.go:217–228  ·  view source on GitHub ↗

getSortedRequests returns a sorted copy of requests based on the checker type. This method creates a copy of the requests to avoid modifying the original collection and sorts them according to the BulkCheckerType (entity ID or subject ID). The sorting ensures consistent and predictable result orderi

()

Source from the content-addressed store, hash-verified

215// collection and sorts them according to the BulkCheckerType (entity ID or subject ID).
216// The sorting ensures consistent and predictable result ordering.
217func (bc *BulkChecker) getSortedRequests() []BulkCheckerRequest {
218 bc.requestsMu.RLock()
219 defer bc.requestsMu.RUnlock()
220
221 // Create a copy to avoid modifying the original
222 requests := make([]BulkCheckerRequest, len(bc.requests))
223 copy(requests, bc.requests)
224
225 // Sort the copy based on the checker type
226 bc.sortRequests(requests)
227 return requests
228}
229
230// sortRequests sorts requests based on the checker type.
231// This method implements different sorting strategies:

Callers 3

ExecuteRequestsMethod · 0.95
callbackWithTokenMethod · 0.95
BenchmarkSortingFunction · 0.95

Calls 1

sortRequestsMethod · 0.95

Tested by 1

BenchmarkSortingFunction · 0.76