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

Method push

packages/computer/src/workspace.ts:557–581  ·  view source on GitHub ↗
(id?: string)

Source from the content-addressed store, hash-verified

555 // span on the configured observer, tagged with the resolved
556 // backend id and the entry count.
557 push(id?: string): Promise<number> {
558 return this.#serialize(id, (resolvedId) =>
559 withSpan(
560 this.#observer,
561 "workspace.sync.push",
562 { "workspace.sync.backend": resolvedId },
563 async () => {
564 if (resolvedId === undefined || this.#moduleBackendsById.has(resolvedId)) return 0;
565 const handle = await this.#handleFor(resolvedId);
566 // A backend that reuses the host store as its sole
567 // source of truth has nothing to ship and no remote to
568 // ship to. Short-circuit so the shell exec bracket can
569 // keep calling push() unconditionally without paying
570 // for it.
571 if (handle.sync === "none") return 0;
572 return this.#runWithInvalidation(resolvedId, handle, () =>
573 pushOnce(this.#db, handle.rpc.sync, resolvedId),
574 );
575 },
576 (span, outcome) => {
577 if (outcome.ok) span.setAttribute("workspace.sync.pushed", outcome.value);
578 },
579 ),
580 );
581 }
582
583 pull(id?: string): Promise<ApplyResult> {
584 return this.#serialize(id, (resolvedId) => this.#pullResolved(resolvedId));

Callers 1

#shellForMethod · 0.95

Calls 7

#serializeMethod · 0.95
#handleForMethod · 0.95
#runWithInvalidationMethod · 0.95
pushOnceFunction · 0.90
withSpanFunction · 0.85
hasMethod · 0.80
setAttributeMethod · 0.65

Tested by

no test coverage detected