MCPcopy Create free account
hub / github.com/Effect-TS/effect / getShared

Function getShared

packages/effect/src/ui/Query.ts:6446–6456  ·  view source on GitHub ↗
(entry: Entry, build: Build)

Source from the content-addressed store, hash-verified

6444
6445 /** Waits for a caller-only fetch, joining the one in flight. */
6446 const getShared = (entry: Entry, build: Build): Effect.Effect<any, any> =>
6447 Effect.callback<any, any>((resume) => {
6448 const waiter: Waiter = { build, resume, shared: undefined }
6449 if (entry.shared === undefined) {
6450 startShared(entry, build, [waiter], false)
6451 } else {
6452 waiter.shared = entry.shared
6453 entry.shared.callers.add(waiter)
6454 }
6455 return Effect.sync(() => leave(entry, waiter))
6456 })
6457
6458 /** Waits for the stored fetch, starting one when none is in flight. */
6459 const getStored = (entry: Entry, build: Build): Effect.Effect<any, any> =>

Callers 1

getFunction · 0.85

Calls 4

startSharedFunction · 0.85
leaveFunction · 0.70
addMethod · 0.65
syncMethod · 0.45

Tested by

no test coverage detected