MCPcopy Create free account
hub / github.com/Open-Bee/DataStudio / _open_read_env

Method _open_read_env

datastudio/utils/database.py:381–396  ·  view source on GitHub ↗

Open a temporary env with readahead=True for batch reading.

(shard_id)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

_get_shard_pathMethod · 0.95
init_sharded_lmdbFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected