我看到了很多这种模式.
在服务器上:
// Get a bounded number of results, along with a resume token to use
// for the next call. Successive calls yield a "weakly consistent" view of
// the underlying set that may or may not reflect concurrent updates.
public<T> String getObjects(
int maxObjects, String resumeToken, List<T> objectsToReturn);
Run Code Online (Sandbox Code Playgroud)
在客户端:
// An iterator wrapping repeated calls to getObjects(bufferSize, ...)
public<T> Iterator<T> getIterator(int bufferSize);
Run Code Online (Sandbox Code Playgroud)
大多数地方都推出了这两种方法的自己版本,并且实现起来非常困难.有很多边缘案例错误.
这些查询是否有规范的配方或库?
(您可以对服务器端存储进行一些简化假设,例如T具有自然顺序).