Query regarding cursors - in Lookup
# spicedb
r
Query regarding cursors - in Lookup endpoints.
the
Copy code
// after_result_cursor holds a cursor that can be used to resume the LookupResources stream after this
    // result.
    Cursor after_result_cursor = 5;
the cursor seems to be retunred at the last stream of results/response as wel (not null/nil), meaning the last batch, how can the client determine the result was the last one and server doesnt have further response data to stream after this response? Since a cursor is returned the client makes another call only to get an empty response
v
that is true, but you only need to do that once per batch. You have to request again, and if the iteration returned zero elements and EOF, you know there are no more elements to stream
a
is it possible you could rely on the last page having less than the page size number of elements? or are middle pages not guaranteed to include a "full" page of $page_size elements, always? (if that makes sense)
v
yes you can also do that, indeed
but it's a bit more annoying because you have to track counters
but gets the job done 👍
4 Views