View Source erlfdb_range_iterator (erlfdb v0.3.4)
An iterator interface over GetRange and GetMappedRange.
The iterator is an alternative implmentation to erlfdb:get_range/4 and
erlfdb:wait_for_all_interleaving/3. The database mechanics are equivalent,
but the iterator allows you to control when each wait actually happens.
Remember that FoundationDB transaction execution time is limited to 5 seconds, so you must take care not to delay your iteration.
To use the iterator,
erlfdb_range_iterator:start/4: Sends the first GetRange request to the database server.erlfdb_iterator.next/1: Waits for the result of the GetRange request. Then issues another GetRange request to the database server.erlfdb_iterator.stop/1: Cancels the active future, if one exists.
Summary
Functions
Gets the active future from the iterator's internal state.
Starts the iterator.
Starts the iterator.
Types
-type page() :: [erlfdb:kv()] | [erlfdb:mapped_kv()].
Functions
-spec get_future(state()) -> undefined | erlfdb:future().
Gets the active future from the iterator's internal state.
You needn't call this function for normal use of the iterator.
-spec handle_stop(state()) -> ok.
-spec start(erlfdb:transaction(), erlfdb:key(), erlfdb:key()) -> erlfdb_iterator:iterator().
Starts the iterator.
Equivalent to start(Tx, StartKey, EndKey, []).
-spec start(erlfdb:transaction(), erlfdb:key(), erlfdb:key(), [erlfdb:fold_option()]) -> erlfdb_iterator:iterator().
Starts the iterator.
Sends the first GetRange request to the database server.