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

Method _get_cache_id

salt/utils/mmap_cache.py:369–384  ·  view source on GitHub ↗

Return a value that changes whenever another process may have modified the on-disk index (so we drop stale mmaps and re-open). Inode alone is insufficient: concurrent writers keep the same inode while mutating the file, which would otherwise leave this process with

(self)

Source from the content-addressed store, hash-verified

367 pass
368
369 def _get_cache_id(self):
370 """
371 Return a value that changes whenever another process may have modified
372 the on-disk index (so we drop stale mmaps and re-open).
373
374 Inode alone is insufficient: concurrent writers keep the same inode
375 while mutating the file, which would otherwise leave this process with
376 a permanently stale ``mmap`` view of the index.
377 """
378 try:
379 st = os.stat(self.path)
380 if st.st_ino:
381 return (st.st_ino, st.st_mtime_ns, st.st_size)
382 return (st.st_mtime, st.st_ctime, st.st_size)
383 except OSError:
384 return None
385
386 def _sync_cache_id_after_local_write(self):
387 """

Calls

no outgoing calls