| 18 | |
| 19 | |
| 20 | def host_digest(shared_database: Path, *, legacy: bool = False) -> str: |
| 21 | if legacy: # pragma: linux cover |
| 22 | return hashlib.sha256(host_name().encode()).hexdigest()[:16] |
| 23 | # Taken from a link of another database, so the sweep for this one has not run yet. |
| 24 | seed: Final[Path] = shared_database.parent.with_name("seed") |
| 25 | seed.mkdir(mode=0o777) |
| 26 | seed.chmod(0o777) |
| 27 | with ReadWriteLock(seed / "lock.db", is_singleton=False).read_lock(): |
| 28 | return next(seed.glob(".filelock-*")).name.rsplit("-", 2)[1] |
| 29 | |
| 30 | |
| 31 | __all__ = [ |