Coverage for src/copytrading_engine/backup/ports.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-11-16 16:55 +0000

1"""What backup and restore need from the engine: a write fence, schemas, account preparation.""" 

2 

3from __future__ import annotations 

4 

5from contextlib import AbstractAsyncContextManager 

6from pathlib import Path 

7from typing import Protocol 

8 

9 

10class BackupFence(Protocol): 

11 def __call__(self) -> AbstractAsyncContextManager[None]: ... 

12 

13 

14class SchemaCatalogProvider(Protocol): 

15 def __call__(self, member_path: str) -> tuple[tuple[str, str, str, str], ...]: ... 

16 

17 

18class AccountSnapshotSchemaProvider(Protocol): 

19 @property 

20 def execution_schema_revision(self) -> int: ... 

21 

22 @property 

23 def snapshot_json_schema_version(self) -> int: ... 

24 

25 def validate_snapshot(self, serialized: str) -> tuple[str | None, str | None]: ... 

26 

27 

28class RestoredAccountPreparer(Protocol): 

29 def __call__(self, path: Path) -> None: ...