Buckets:
| import { Layer, type Context, ManagedRuntime, type Effect } from "effect" | |
| import { memoMap } from "./memo-map" | |
| import { Observability } from "../observability" | |
| export function makeRuntime<I, S, E>(service: Context.Service<I, S>, layer: Layer.Layer<I, E>) { | |
| let rt: ManagedRuntime.ManagedRuntime<I, E> | undefined | |
| const getRuntime = () => | |
| (rt ??= ManagedRuntime.make(Layer.provideMerge(layer, Observability.layer) as Layer.Layer<I, E>, { | |
| memoMap, | |
| })) | |
| return { | |
| runSync: <A, Err>(fn: (svc: S) => Effect.Effect<A, Err, I>) => getRuntime().runSync(service.use(fn)), | |
| runPromiseExit: <A, Err>(fn: (svc: S) => Effect.Effect<A, Err, I>, options?: Effect.RunOptions) => | |
| getRuntime().runPromiseExit(service.use(fn), options), | |
| runPromise: <A, Err>(fn: (svc: S) => Effect.Effect<A, Err, I>, options?: Effect.RunOptions) => | |
| getRuntime().runPromise(service.use(fn), options), | |
| runFork: <A, Err>(fn: (svc: S) => Effect.Effect<A, Err, I>) => getRuntime().runFork(service.use(fn)), | |
| runCallback: <A, Err>(fn: (svc: S) => Effect.Effect<A, Err, I>) => getRuntime().runCallback(service.use(fn)), | |
| } | |
| } | |
Xet Storage Details
- Size:
- 1.13 kB
- Xet hash:
- 163654030ad6ba5d2032bf0c521c3c7207a20c3d5f448a87127b2f7b2476c95a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.