MCPcopy Create free account
hub / github.com/cloudflare/computer / #serialize

Method #serialize

packages/computer/src/workspace.ts:721–740  ·  view source on GitHub ↗
(
    id: string | undefined,
    fn: (resolvedId: string | undefined) => Promise<T>,
  )

Source from the content-addressed store, hash-verified

719 // the queue — the caller still sees the original rejection
720 // through the returned promise.
721 #serialize<T>(
722 id: string | undefined,
723 fn: (resolvedId: string | undefined) => Promise<T>,
724 ): Promise<T> {
725 const resolved = this.#resolveBackendId(id);
726 const slot = resolved ?? "";
727 const tail = this.#mutationTails.get(slot) ?? Promise.resolve();
728 const run = tail.then(
729 () => fn(resolved),
730 () => fn(resolved),
731 );
732 this.#mutationTails.set(
733 slot,
734 run.then(
735 () => undefined,
736 () => undefined,
737 ),
738 );
739 return run;
740 }
741
742 // Resolve an exec / push / pull caller's id argument to a
743 // concrete backend id. Returns undefined for a filesystem-only

Callers 4

pushMethod · 0.95
pullMethod · 0.95
retryPendingSyncMethod · 0.95
#schedulePendingSyncMethod · 0.95

Calls 4

#resolveBackendIdMethod · 0.95
resolveMethod · 0.80
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected