Buckets:
| import { Effect, Layer } from "effect" | |
| import { LocationServiceMap } from "../../location-layer" | |
| import { SessionRunCoordinator } from "../run-coordinator" | |
| import { SessionRunner } from "../runner" | |
| import { SessionSchema } from "../schema" | |
| import { SessionStore } from "../store" | |
| import { SessionExecution } from "../execution" | |
| import { logFailure } from "../logging" | |
| /** Current-process routing for implicit-local Locations. Future remote placement belongs here. */ | |
| export const layer = Layer.effect( | |
| SessionExecution.Service, | |
| Effect.gen(function* () { | |
| const store = yield* SessionStore.Service | |
| const locations = yield* LocationServiceMap | |
| const coordinator = yield* SessionRunCoordinator.make<SessionSchema.ID, void, SessionRunner.RunError>({ | |
| drain: Effect.fnUntraced(function* (sessionID: SessionSchema.ID, mode) { | |
| const session = yield* store.get(sessionID) | |
| if (!session) return yield* Effect.die(`Session not found: ${sessionID}`) | |
| return yield* SessionRunner.Service.use((runner) => runner.run({ sessionID, force: mode === "run" })).pipe( | |
| Effect.provide(locations.get(session.location)), | |
| ) | |
| }), | |
| onFailure: (sessionID, cause) => logFailure("Failed to drain Session", sessionID, cause), | |
| }) | |
| return SessionExecution.Service.of({ | |
| interrupt: coordinator.interrupt, | |
| resume: coordinator.run, | |
| wake: coordinator.wake, | |
| }) | |
| }), | |
| ) | |
| export const defaultLayer = layer.pipe(Layer.provide(SessionStore.defaultLayer)) | |
Xet Storage Details
- Size:
- 1.51 kB
- Xet hash:
- ba76b41aef030d274edbb6e4a78bee7377617c0f259f2098802e1f03c58fd747
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.