Files

17 lines
573 B
Python

"""The SDM side of the device audit: DeviceAccess calls this sink, which writes
SeismoDb.device_commands. Kept here so sfm.device_access never imports the DB."""
from __future__ import annotations
from typing import Any, Callable
class DbAudit:
def __init__(self, get_db: Callable[[], Any]) -> None:
self._get_db = get_db
def begin(self, **fields: Any) -> str:
return self._get_db().begin_device_command(**fields)
def finish(self, command_id: str, **fields: Any) -> None:
self._get_db().finish_device_command(command_id, **fields)