( transaction: DirectoryBinding, name: MemoryDocumentName, )
| 452 | } |
| 453 | |
| 454 | async function readDisplacedDocument( |
| 455 | transaction: DirectoryBinding, |
| 456 | name: MemoryDocumentName, |
| 457 | ): Promise<MemoryDocumentSnapshot | undefined> { |
| 458 | try { |
| 459 | const bytes = await readExactFile( |
| 460 | displacedPath(transaction.path, name), |
| 461 | `${displayName(name)} displaced state`, |
| 462 | DOCUMENT_SCAN_MAX_BYTES, |
| 463 | ); |
| 464 | await assertDirectoryBinding(transaction); |
| 465 | return snapshotForBytes(bytes); |
| 466 | } catch (error) { |
| 467 | if (isNodeError(error, 'ENOENT')) { |
| 468 | await assertDirectoryBinding(transaction); |
| 469 | return undefined; |
| 470 | } |
| 471 | throw error; |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | async function restoreUnexpectedDisplaced( |
| 476 | directory: DirectoryBinding, |
no test coverage detected