MCPcopy Index your code
hub / github.com/saltstack/salt / _concurrent_reader

Function _concurrent_reader

tests/pytests/functional/utils/test_mmap_cache.py:284–295  ·  view source on GitHub ↗

Read continuously while rebuild is happening; collect any anomalies.

(idx_path, stop_event, errors)

Source from the content-addressed store, hash-verified

282
283
284def _concurrent_reader(idx_path, stop_event, errors):
285 """Read continuously while rebuild is happening; collect any anomalies."""
286 c = MmapCache(idx_path, size=256, slot_size=128, key_size=48)
287 while not stop_event.is_set():
288 keys = c.list_keys()
289 # After rebuild the cache must be self-consistent:
290 # every key returned by list_keys must be gettable.
291 for k in keys:
292 v = c.get(k)
293 if v is None:
294 errors.append(f"list_keys returned {k!r} but get returned None")
295 c.close()
296
297
298class TestAtomicRebuild:

Callers

nothing calls this directly

Calls 5

list_keysMethod · 0.95
getMethod · 0.95
closeMethod · 0.95
MmapCacheClass · 0.90
appendMethod · 0.45

Tested by

no test coverage detected