Package com.googlecode.objectify.impl
Class ChunkingIterator<T>
java.lang.Object
com.googlecode.objectify.impl.ChunkingIterator<T>
- All Implemented Interfaces:
com.google.appengine.api.datastore.QueryResultIterator<T>
,Iterator<T>
public class ChunkingIterator<T> extends Object implements com.google.appengine.api.datastore.QueryResultIterator<T>
Base class for normal and hybrid iterators, handles the chunking logic.
The bulk of the complexity is in the QueryResultStreamIterator; this just handles stripping out
null values but being careful about preserving cursor behavior.
-
Constructor Summary
ConstructorDescriptionChunkingIterator(LoadEngine loadEngine, com.google.appengine.api.datastore.PreparedQuery pq, com.google.appengine.api.datastore.QueryResultIterator<Key<T>> source, int chunkSize)
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.appengine.api.datastore.Cursor
From Alfred Fuller (principal GAE datastore guru): Calling getCursor() for results in the middle of a batch forces the sdk to run a new query as seen here: http://code.google.com/p/googleappengine/source/browse/trunk/java/src/main/com/google/appengine/api/datastore/Cursor.java#70 Doing this for every result will definitely give you really bad performance.List<com.google.appengine.api.datastore.Index>
boolean
hasNext()
next()
void
remove()
Not implementedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
ChunkingIterator
public ChunkingIterator(LoadEngine loadEngine, com.google.appengine.api.datastore.PreparedQuery pq, com.google.appengine.api.datastore.QueryResultIterator<Key<T>> source, int chunkSize)
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove()Not implemented -
getCursor
public com.google.appengine.api.datastore.Cursor getCursor()From Alfred Fuller (principal GAE datastore guru): Calling getCursor() for results in the middle of a batch forces the sdk to run a new query as seen here: http://code.google.com/p/googleappengine/source/browse/trunk/java/src/main/com/google/appengine/api/datastore/Cursor.java#70 Doing this for every result will definitely give you really bad performance. I have several yet to be implemented ideas that would solve this problem (which you potentially could push me into prioritizing), but I believe you can solve the performance problem today by saving the start_cursor an offset into the batch. Then you can evaluate the real cursor on demand using "query.asQueryResultIterator(withStartCursor(cursor).offset(n).limit(0)).getCursor()"- Specified by:
getCursor
in interfacecom.google.appengine.api.datastore.QueryResultIterator<T>
-
getIndexList
- Specified by:
getIndexList
in interfacecom.google.appengine.api.datastore.QueryResultIterator<T>
-