Package org.zvec.binding
Class DocIterator
java.lang.Object
org.zvec.binding.DocIterator
- All Implemented Interfaces:
AutoCloseable
A snapshot document iterator over a collection (zvec ≥ v0.7.0), created
via
Collection.createIterator(IteratorOptions).
The iterator takes an isolated snapshot at creation time. Always
close() the iterator before releasing the last handle of its
collection; while an iterator is open, schema changes and destroy on the
collection return an error.
Typical usage:
try (DocIterator it = collection.createIterator(null)) {
Doc doc;
while ((doc = it.next()) != null) {
try {
// ... read doc ...
} finally {
doc.close();
}
}
}
-
Method Summary
-
Method Details
-
next
Advance the iterator and return the next document, ornullwhen the end of the snapshot is reached (EOF). The returnedDocis owned by the caller; release it withDoc.close()when done. -
close
public void close()Close the iterator and release all its resources. Idempotent.- Specified by:
closein interfaceAutoCloseable
-