Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ServerProvider.ts

19 lines890 Bytes

1import type { ProviderUsageLimitsUpdate, ServerProvider } from "@t3tools/contracts";
2import type * as Effect from "effect/Effect";
3import type * as Stream from "effect/Stream";
4import type { ProviderMaintenanceCapabilities } from "../providerMaintenance.ts";
5​
6export interface ServerProviderShape {
7 readonly maintenanceCapabilities: ProviderMaintenanceCapabilities;
8 readonly getSnapshot: Effect.Effect<ServerProvider>;
9 readonly refresh: Effect.Effect<ServerProvider>;
10 readonly streamChanges: Stream.Stream<ServerProvider>;
11 /**
12 * Fold a runtime rate-limit update into the published snapshot without
13 * waiting for the next status probe. Sparse: windows merge by id and an
14 * update with no usable window leaves the snapshot untouched.
15 */
16 readonly applyUsageLimits: (
17 update: ProviderUsageLimitsUpdate & { readonly checkedAt: string },
18 ) => Effect.Effect<void>;