55 lines
1.2 KiB
Python
55 lines
1.2 KiB
Python
"""Protocol definitions for the discovery package"""
|
|
from typing import Iterator, Protocol, Any
|
|
from pathlib import Path
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass
|
|
class FileMeta:
|
|
"""Metadata for a discovered file"""
|
|
path: Path
|
|
size: int
|
|
modified_time: float
|
|
created_time: float
|
|
# Add other metadata fields as needed
|
|
|
|
|
|
@dataclass
|
|
class MountInfo:
|
|
"""Information about a mounted filesystem"""
|
|
device: str
|
|
mount_point: str
|
|
fs_type: str
|
|
options: str
|
|
# Add other mount info fields as needed
|
|
|
|
|
|
@dataclass
|
|
class DiskInfo:
|
|
"""Information about a disk/NVMe device"""
|
|
device: str
|
|
model: str
|
|
size: int
|
|
serial: str
|
|
# Add other disk info fields as needed
|
|
|
|
|
|
class IFileScanner(Protocol):
|
|
"""Protocol for file scanning operations"""
|
|
|
|
def scan(self, root: Path) -> Iterator[FileMeta]:
|
|
"""Scan a directory tree and yield file metadata"""
|
|
...
|
|
|
|
|
|
class ISystemAPI(Protocol):
|
|
"""Protocol for system information queries"""
|
|
|
|
def query_mounts(self) -> list[MountInfo]:
|
|
"""Query mounted filesystems"""
|
|
...
|
|
|
|
def query_nvmes(self) -> list[DiskInfo]:
|
|
"""Query NVMe/disk information"""
|
|
...
|