MCPcopy Index your code
hub / github.com/Effect-TS/effect / makeClientRespond

Function makeClientRespond

packages/cluster/src/Sharding.ts:1167–1192  ·  view source on GitHub ↗
(
    entry: ClientRequestEntry,
    write: (reply: FromServer<any>) => Effect.Effect<void>
  )

Source from the content-addressed store, hash-verified

1165 const clientRespondDiscard = (_reply: Reply.Reply<any>) => Effect.void
1166
1167 const makeClientRespond = (
1168 entry: ClientRequestEntry,
1169 write: (reply: FromServer<any>) => Effect.Effect<void>
1170 ) =>
1171 (reply: Reply.Reply<any>) => {
1172 switch (reply._tag) {
1173 case "Chunk": {
1174 entry.lastChunkId = reply.id
1175 return write({
1176 _tag: "Chunk",
1177 clientId: 0,
1178 requestId: RequestId(reply.requestId),
1179 values: reply.values
1180 })
1181 }
1182 case "WithExit": {
1183 clientRequests.delete(reply.requestId)
1184 return write({
1185 _tag: "Exit",
1186 clientId: 0,
1187 requestId: RequestId(reply.requestId),
1188 exit: reply.exit
1189 })
1190 }
1191 }
1192 }
1193
1194 // --- Singletons ---
1195

Callers 1

onFromClientFunction · 0.85

Calls 2

RequestIdFunction · 0.90
writeFunction · 0.50

Tested by

no test coverage detected