Пример #1
0
 def __refresh_cache(self):
     if self._next_item is None:
         self._cache = list(
             _EggRoll.get_instance().iterate(self._table, kv_pb2.Range(start=self._start, end=self._end, minChunkSize=self._min_chunk_size)))
     else:
         self._cache = list(
             _EggRoll.get_instance().iterate(self._table, kv_pb2.Range(start=self._next_item.key, end=self._end, minChunkSize=self._min_chunk_size)))
     if len(self._cache) == 0:
         raise StopIteration
     self._index = 0
Пример #2
0
 def __refresh_cache(self):
     if self._next_item is None:
         self._cache = list(
             self.stub.iterate(kv_pb2.Range(start=self._start,
                                            end=self._end),
                               metadata=self.meta))
     else:
         self._cache = list(
             self.stub.iterate(kv_pb2.Range(start=self._next_item.key,
                                            end=self._end),
                               metadata=self.meta))
     # if self._next_item is not None and len(self._cache) > 0 and self._cache[0].key == self._next_item.key:
     #     self._cache = self._cache[1:]
     if len(self._cache) == 0:
         raise StopIteration
     self._index = 0
Пример #3
0
 def _fetch(self):
     start = self._start if self._next_item is None else self._next_item.key
     self._cache = list(
         self.kv_stub.iterate(kv_pb2.Range(
             start=start, end=self._end, minChunkSize=self._min_chunk_size),
                              metadata=self.adapter.get_stream_meta()))
     if len(self._cache) == 0:
         raise StopIteration
     self._index = 0