MCPcopy Create free account
hub / github.com/cloudflare/computer / pushObjects

Function pushObjects

packages/dofs/src/sync/push.ts:13–27  ·  view source on GitHub ↗
(
  db: Database,
  hashes: Uint8Array[],
)

Source from the content-addressed store, hash-verified

11// fetchObjects on one side and pushObjects on the other. Both names
12// resolve to the same SQL.
13export async function* pushObjects(
14 db: Database,
15 hashes: Uint8Array[],
16): AsyncIterable<{ hash: Uint8Array; bytes: Uint8Array }> {
17 for (const hash of hashes) {
18 const row = db.one<{ bytes: Uint8Array }>(
19 "SELECT bytes FROM vfs_blob_bytes WHERE hash = ?",
20 hash,
21 );
22 if (row === undefined) {
23 throw createWorkspaceError("EUNKNOWN_HASH", "pushObjects: missing blob for requested hash");
24 }
25 yield { hash, bytes: row.bytes };
26 }
27}

Callers 3

push.test.tsFile · 0.70
pullFunction · 0.70
fetchObjectsFunction · 0.70

Calls 2

oneMethod · 0.80
createWorkspaceErrorFunction · 0.50

Tested by 1

pullFunction · 0.56