def test_scan(client, cache): page_size = 10 result = cache_put_all(client, cache, { 'key_{}'.format(v): v for v in range(page_size * 2) }) assert result.status == 0 result = scan(client, cache, page_size) assert result.status == 0 assert len(result.value['data']) == page_size assert result.value['more'] is True cursor = result.value['cursor'] result = scan_cursor_get_page(client, cursor) assert result.status == 0 assert len(result.value['data']) == page_size assert result.value['more'] is False result = scan_cursor_get_page(client, cursor) assert result.status != 0
def test_scan(client, cache): page_size = 10 result = cache_put_all( client, cache, {'key_{}'.format(v): v for v in range(page_size * 2)}) assert result.status == 0 result = scan(client, cache, page_size) assert result.status == 0 assert len(result.value['data']) == page_size assert result.value['more'] is True cursor = result.value['cursor'] result = scan_cursor_get_page(client, cursor) assert result.status == 0 assert len(result.value['data']) == page_size assert result.value['more'] is False result = scan_cursor_get_page(client, cursor) assert result.status != 0
def __next__(self): if not self.data: raise StopIteration try: k, v = next(self.data) except StopIteration: if self.more: self._process_page_response( scan_cursor_get_page(self.connection, self.cursor_id)) k, v = next(self.data) else: raise StopIteration return self.client.unwrap_binary(k), self.client.unwrap_binary(v)