mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-23 06:09:59 +00:00
Fixes some types, adds some types, and adds some override annotations. Signed-off-by: Tristan Partin <tristan@neon.tech>
22 lines
569 B
Python
22 lines
569 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
from typing import TYPE_CHECKING
|
|
|
|
import psutil
|
|
|
|
if TYPE_CHECKING:
|
|
from collections.abc import Iterator
|
|
|
|
|
|
def iter_mounts_beneath(topdir: Path) -> Iterator[Path]:
|
|
"""
|
|
Iterate over the overlayfs mounts beneath the specififed `topdir`.
|
|
The `topdir` itself isn't considered.
|
|
"""
|
|
for part in psutil.disk_partitions(all=True):
|
|
if part.fstype == "overlay":
|
|
mountpoint = Path(part.mountpoint)
|
|
if topdir in mountpoint.parents:
|
|
yield mountpoint
|