Open a temporary env with readahead=True for batch reading.
(shard_id)
| 379 | ) |
| 380 | |
| 381 | def _open_read_env(shard_id): |
| 382 | """Open a temporary env with readahead=True for batch reading.""" |
| 383 | shard_path = self._get_shard_path(shard_id) |
| 384 | data_file = os.path.join(shard_path, "data.mdb") |
| 385 | actual_map_size = self.map_size_per_shard |
| 386 | if os.path.exists(data_file): |
| 387 | actual_size = os.path.getsize(data_file) |
| 388 | if actual_size > self.map_size_per_shard: |
| 389 | actual_map_size = actual_size * 2 |
| 390 | return init_sharded_lmdb( |
| 391 | shard_path, |
| 392 | map_size=actual_map_size, |
| 393 | readonly=True, |
| 394 | lock=False, |
| 395 | readahead=True, |
| 396 | ) |
| 397 | |
| 398 | def _read_shard(shard_id_and_items): |
| 399 | shard_id, items = shard_id_and_items |
nothing calls this directly
no test coverage detected