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

Function write

packages/effect/src/unstable/eventlog/EventJournal.ts:389–411  ·  view source on GitHub ↗
({ effect, event, payload, primaryKey })

Source from the content-addressed store, hash-verified

387 return EventJournal.of({
388 entries: Effect.sync(() => journal.slice()),
389 write({ effect, event, payload, primaryKey }) {
390 return Effect.acquireUseRelease(
391 Effect.sync(() =>
392 new Entry({
393 id: makeEntryIdUnsafe(),
394 event,
395 primaryKey,
396 payload
397 }, { disableChecks: true })
398 ),
399 effect,
400 (entry, exit) =>
401 Effect.suspend(() => {
402 if (exit._tag === "Failure" || byId.has(entry.idString)) return Effect.void
403 journal.push(entry)
404 byId.set(entry.idString, entry)
405 remotes.forEach((remote) => {
406 remote.missing.push(entry)
407 })
408 return PubSub.publish(pubsub, entry)
409 })
410 )
411 },
412 writeFromRemote: Effect.fnUntraced(function*(options) {
413 const remote = ensureRemote(options.remoteId)
414 const uncommittedRemotes: Array<RemoteEntry> = []

Callers

nothing calls this directly

Calls 7

makeEntryIdUnsafeFunction · 0.85
pushMethod · 0.80
setMethod · 0.65
forEachMethod · 0.65
publishMethod · 0.65
syncMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected