INNER CODE UNIT · Python
DatabaseManager
BlessedRebuS/Krawl · src/database/core.py:134
class DatabaseManager:
"""
Singleton database manager for the Krawl honeypot.
Handles database initialization, session management, and provides
methods for persisting access logs, credentials, and attack detections.
"""
_instance: Optional["DatabaseManager"] = None
def __new__(cls) -> "DatabaseManager":
if cls._instance is None:
cls._instance = super().__new__(cls)
cls._instance._initialized = False
# Wire up domain sub-repositories up front so `db.<repo>` is always
# present, even before initialize(). Each holds a back-reference to
# the manager for session access; their methods raise the usual
# "not initialized" error if used before initialize() (same as the