Read metadata from lock database for backward compatibility. Args: lock_file_path: Path to the lock file Returns: Dictionary with metadata, or None if no lock is held
(lock_file_path: Path)
| 57 | |
| 58 | |
| 59 | def _read_lock_metadata(lock_file_path: Path) -> dict[str, Any] | None: |
| 60 | """Read metadata from lock database for backward compatibility. |
| 61 | |
| 62 | Args: |
| 63 | lock_file_path: Path to the lock file |
| 64 | |
| 65 | Returns: |
| 66 | Dictionary with metadata, or None if no lock is held |
| 67 | """ |
| 68 | db = get_lock_database(lock_file_path) |
| 69 | lock_name = str(lock_file_path) |
| 70 | holders = db.get_lock_info(lock_name) |
| 71 | if not holders: |
| 72 | return None |
| 73 | |
| 74 | # Return first holder's info in the legacy format |
| 75 | holder = holders[0] |
| 76 | return { |
| 77 | "pid": holder["owner_pid"], |
| 78 | "timestamp": str(holder["acquired_at"]), |
| 79 | "operation": holder["operation"], |
| 80 | "hostname": holder["hostname"], |
| 81 | } |
| 82 | |
| 83 | |
| 84 | def _remove_lock_metadata(lock_file_path: Path) -> None: |