|
|
@@ -334,14 +334,14 @@ class NilmDB(object): |
|
|
|
|
|
|
|
Returns (intervals, restart) tuple. |
|
|
|
|
|
|
|
intervals is a list of [start,end] timestamps of all intervals |
|
|
|
'intervals' is a list of [start,end] timestamps of all intervals |
|
|
|
that exist for path, between start and end. |
|
|
|
|
|
|
|
restart, if nonzero, means that there were too many results to |
|
|
|
return in a single request. The data is complete from the |
|
|
|
starting timestamp to the point at which it was truncated, |
|
|
|
and a new request with a start time of 'restart' will fetch |
|
|
|
the next block of data. |
|
|
|
'restart', if not None, means that there were too many results |
|
|
|
to return in a single request. The data is complete from the |
|
|
|
starting timestamp to the point at which it was truncated, and |
|
|
|
a new request with a start time of 'restart' will fetch the |
|
|
|
next block of data. |
|
|
|
""" |
|
|
|
stream_id = self._stream_id(path) |
|
|
|
intervals = self._get_intervals(stream_id) |
|
|
@@ -363,7 +363,7 @@ class NilmDB(object): |
|
|
|
break |
|
|
|
result.append([i.start, i.end]) |
|
|
|
else: |
|
|
|
restart = 0 |
|
|
|
restart = None |
|
|
|
return (result, restart) |
|
|
|
|
|
|
|
def stream_create(self, path, layout_name): |
|
|
@@ -521,10 +521,10 @@ class NilmDB(object): |
|
|
|
""" |
|
|
|
Returns (data, restart) tuple. |
|
|
|
|
|
|
|
data is ASCII-formatted data from the database, formatted |
|
|
|
'data' is ASCII-formatted data from the database, formatted |
|
|
|
according to the layout of the stream. |
|
|
|
|
|
|
|
restart, if nonzero, means that there were too many results to |
|
|
|
'restart', if not None, means that there were too many results to |
|
|
|
return in a single request. The data is complete from the |
|
|
|
starting timestamp to the point at which it was truncated, |
|
|
|
and a new request with a start time of 'restart' will fetch |
|
|
@@ -543,7 +543,7 @@ class NilmDB(object): |
|
|
|
result = [] |
|
|
|
matched = 0 |
|
|
|
remaining = self.max_results |
|
|
|
restart = 0 |
|
|
|
restart = None |
|
|
|
for interval in intervals.intersection(requested): |
|
|
|
# Reading single rows from the table is too slow, so |
|
|
|
# we use two bisections to find both the starting and |
|
|
@@ -568,7 +568,7 @@ class NilmDB(object): |
|
|
|
# Count them |
|
|
|
remaining -= row_end - row_start |
|
|
|
|
|
|
|
if restart: |
|
|
|
if restart is not None: |
|
|
|
break |
|
|
|
|
|
|
|
if count: |
|
|
|