| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Error classification + self-healing recovery: classify infrastructure |
| 9 |
* errors, detect OOM, REPAIR TABLE for crashed tables, fix duplicate |
| 10 |
* auto_increment IDs, recover from collation mismatches, and the test seam |
| 11 |
* for the injected clock. |
| 12 |
* |
| 13 |
* Legacy view-build staged-failure routing (the 'resumable'/'skip'/'halt' |
| 14 |
* /'rethrow' classifier) intentionally lives outside this database-layer |
| 15 |
* interface: those tokens are not database recovery vocabulary. |
| 16 |
*/ |
| 17 |
interface ABJ_404_Solution_DatabaseErrorRecoveryInterface { |
| 18 |
|
| 19 |
/** |
| 20 |
* Classify an error as infrastructure (server-side) and handle it. |
| 21 |
* |
| 22 |
* @param string $errorText |
| 23 |
* @return bool True if handled as infrastructure error. |
| 24 |
*/ |
| 25 |
public function classifyAndHandleInfrastructureError(string $errorText): bool; |
| 26 |
|
| 27 |
/** |
| 28 |
* @param string $errorText |
| 29 |
* @return bool |
| 30 |
*/ |
| 31 |
public function isOutOfMemoryError(string $errorText): bool; |
| 32 |
|
| 33 |
/** |
| 34 |
* Attempt REPAIR TABLE for crashed or corrupted-key-file tables. |
| 35 |
* |
| 36 |
* @param string $errorMessage The MySQL error string. |
| 37 |
* @return void |
| 38 |
*/ |
| 39 |
public function repairTable(string $errorMessage): void; |
| 40 |
|
| 41 |
/** |
| 42 |
* Attempt to fix duplicate auto_increment IDs caused by ALTER TABLE resequencing. |
| 43 |
* |
| 44 |
* @param string $errorMessage The MySQL error string. |
| 45 |
* @param string $sqlThatWasRun The SQL that triggered the error. |
| 46 |
* @return void |
| 47 |
*/ |
| 48 |
public function repairDuplicateIDs(string $errorMessage, string $sqlThatWasRun): void; |
| 49 |
|
| 50 |
/** |
| 51 |
* Schedule schema-wide collation recovery outside the foreground request. |
| 52 |
* |
| 53 |
* @return void |
| 54 |
*/ |
| 55 |
public function scheduleCollationRecovery(): void; |
| 56 |
|
| 57 |
/** |
| 58 |
* Inject the clock instance for testability. |
| 59 |
* |
| 60 |
* @param ABJ_404_Solution_Clock $clock |
| 61 |
* @return void |
| 62 |
*/ |
| 63 |
public function setClock(ABJ_404_Solution_Clock $clock): void; |
| 64 |
} |
| 65 |
|