MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / load

Function load

packages/core/sdk/src/shape-memory.ts:44–56  ·  view source on GitHub ↗
(address: string, owner: Owner)

Source from the content-addressed store, hash-verified

42 const cacheKey = (owner: Owner, address: string) => `${owner}:${address}`;
43
44 const load = (address: string, owner: Owner): Effect.Effect<ObservedShape | null> =>
45 Effect.gen(function* () {
46 const key = cacheKey(owner, address);
47 const hit = cache.get(key);
48 if (hit !== undefined) return hit;
49 const entry = yield* storage
50 .getForOwner<ObservedShape>({ owner, collection: COLLECTION, key: address })
51 .pipe(Effect.catch(() => Effect.succeed(null)));
52 const record = entry?.data ?? null;
53 cache.set(key, record);
54 if (record !== null) persisted.set(key, JSON.stringify(record.schema));
55 return record;
56 });
57
58 const observe = (address: string, owner: Owner, value: unknown): Effect.Effect<void> =>
59 Effect.gen(function* () {

Callers 2

observeFunction · 0.70
makeShapeMemoryFunction · 0.70

Calls 3

cacheKeyFunction · 0.70
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected