Files
awg-dash/backend/awg_api/store/__init__.py
T

104 lines
2.4 KiB
Python

"""Слой хранения состояния awg-dash (issue #20).
Состав: SQLite (WAL) в ``/data/awg-dash.db``, версионированные миграции,
проверка схемы при старте, журнал аудита «кто/когда/что/old→new» и движок
атомарного применения ``validate -> stage -> apply -> rollback``.
"""
from __future__ import annotations
from .apply import (
Applier,
ApplyEngine,
ApplyResult,
DesiredState,
NullApplier,
StagedPlan,
)
from .audit import count as audit_count
from .audit import last_entry as audit_last_entry
from .audit import list_entries as list_audit_entries
from .audit import record as record_audit
from .db import DB_PATH_ENV, DEFAULT_DB_PATH, Database, resolve_db_path
from .errors import ApplyError, SchemaError, StorageError, ValidationError
from .migrations import (
EXPECTED_TABLES,
LATEST_VERSION,
MIGRATIONS,
SCHEMA_MIGRATIONS,
Migration,
MigrationReport,
current_version,
migrate,
verify_schema,
)
from .models import (
AUDIT_STATUS_FAILED,
AUDIT_STATUS_OK,
AUDIT_STATUS_STAGED,
DEVICE_POLICIES,
RULE_KINDS,
AuditEntry,
ConfigMeta,
Device,
Entity,
GeoIpSchedule,
Mode,
Rule,
RuleException,
)
from .repository import Store
from .service import Storage, open_storage, rollback_to
from .state import StateSnapshot, capture_state, restore_state, rollback_to_snapshot
__all__ = [
"AUDIT_STATUS_FAILED",
"AUDIT_STATUS_OK",
"AUDIT_STATUS_STAGED",
"DB_PATH_ENV",
"DEFAULT_DB_PATH",
"DEVICE_POLICIES",
"EXPECTED_TABLES",
"LATEST_VERSION",
"MIGRATIONS",
"RULE_KINDS",
"SCHEMA_MIGRATIONS",
"Applier",
"ApplyEngine",
"ApplyError",
"ApplyResult",
"AuditEntry",
"ConfigMeta",
"Database",
"DesiredState",
"Device",
"Entity",
"GeoIpSchedule",
"Migration",
"MigrationReport",
"Mode",
"NullApplier",
"Rule",
"RuleException",
"SchemaError",
"StagedPlan",
"StateSnapshot",
"Storage",
"StorageError",
"Store",
"ValidationError",
"audit_count",
"audit_last_entry",
"capture_state",
"current_version",
"list_audit_entries",
"migrate",
"open_storage",
"record_audit",
"resolve_db_path",
"restore_state",
"rollback_to",
"rollback_to_snapshot",
"verify_schema",
]