MCPcopy Create free account
hub / github.com/apache/maka / readDisplacedDocument

Function readDisplacedDocument

packages/storage/src/memory-bundle-io.ts:454–473  ·  view source on GitHub ↗
(
  transaction: DirectoryBinding,
  name: MemoryDocumentName,
)

Source from the content-addressed store, hash-verified

452}
453
454async 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
475async function restoreUnexpectedDisplaced(
476 directory: DirectoryBinding,

Callers 2

materializeDocumentFunction · 0.85

Calls 6

readExactFileFunction · 0.85
displacedPathFunction · 0.85
assertDirectoryBindingFunction · 0.85
snapshotForBytesFunction · 0.85
displayNameFunction · 0.70
isNodeErrorFunction · 0.70

Tested by

no test coverage detected