Skip to content
Snippets Groups Projects
Commit 0070e9bc authored by Philip ABBET's avatar Philip ABBET
Browse files

Refactoring: The 'done()' method of database views must now take a 'last_data_index' parameter

parent 7b3efc83
Branches
Tags
No related merge requests found
......@@ -828,9 +828,11 @@ class MemoryDataSource(DataSource):
self.data = []
self._done_callback = done_callback
self._next_callback = next_callback
self._last_data_index = -1
def add(self, data, start_data_index, end_data_index):
self.data.append((data, start_data_index, end_data_index))
self._last_data_index = end_data_index
def next(self):
"""Retrieves the next block of data
......@@ -839,7 +841,7 @@ class MemoryDataSource(DataSource):
"""
if (len(self.data) == 0) and (self._next_callback is not None):
if not(self._done_callback()):
if not(self._done_callback(self._last_data_index)):
self._next_callback()
if len(self.data) == 0:
......@@ -848,10 +850,10 @@ class MemoryDataSource(DataSource):
return self.data.pop(0)
def hasMoreData(self):
if len(self.data) != 0:
return True
return not self._done_callback()
return not self._done_callback(self._last_data_index)
def statistics(self):
"""Return the statistics about the number of bytes read from the cache"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment