@voltro/kv 0.89.1 → 0.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -266,7 +266,23 @@ export declare const byTenant: (target: ConnectionRef<"redis">) => ConnectionRou
266
266
 
267
267
  declare type ByteStream = Stream.Stream<Uint8Array, StorageError>;
268
268
 
269
- /** One cache program. Every accessed key is declared; memberships are versioned. */
269
+ /**
270
+ * The bounded unit of every multi-step maintenance command. Clear and tag
271
+ * invalidation take effect in one O(1) transition and reclaim storage in
272
+ * pages of at most this many entries, so no command declares a whole
273
+ * namespace or replies with a whole tag.
274
+ */
275
+ export declare const CACHE_ATOMIC_PAGE = 64;
276
+
277
+ /** The largest SCAN hint one maintenance page asks for. */
278
+ export declare const CACHE_ATOMIC_SCAN = 200;
279
+
280
+ /**
281
+ * One cache program. Every accessed key is declared; memberships are versioned.
282
+ * Entries carry the namespace generation they were written in (absent = 0); an
283
+ * entry of another generation, or one missing a live membership, is unreadable
284
+ * and reclaimable.
285
+ */
270
286
  export declare const CACHE_ATOMIC_SCRIPT: string;
271
287
 
272
288
  /**
@@ -280,8 +296,6 @@ export declare const CACHE_FENCE_RETENTION_MS = 900000;
280
296
  export declare const cacheAtomicArray: (input: unknown) => ReadonlyArray<unknown>;
281
297
 
282
298
  export declare type CacheAtomicCommand = {
283
- readonly op: 'revision';
284
- } | {
285
299
  readonly op: 'fence';
286
300
  } | {
287
301
  readonly op: 'inspect';
@@ -293,18 +307,15 @@ export declare type CacheAtomicCommand = {
293
307
  readonly op: 'read';
294
308
  readonly key: string;
295
309
  readonly snapshot: CacheAtomicSnapshot | null;
296
- } | {
297
- readonly op: 'tag';
298
- readonly tag: string;
299
310
  } | {
300
311
  readonly op: 'scan';
301
312
  readonly cursor: string;
313
+ readonly count: number;
302
314
  } | {
303
315
  readonly op: 'write';
304
316
  readonly key: string;
305
317
  readonly snapshot: CacheAtomicSnapshot | null;
306
318
  readonly version: string;
307
- readonly revision: string;
308
319
  readonly tags: ReadonlyArray<string>;
309
320
  readonly value: string;
310
321
  readonly ttlMs: number | null;
@@ -313,17 +324,38 @@ export declare type CacheAtomicCommand = {
313
324
  readonly op: 'remove';
314
325
  readonly key: string;
315
326
  readonly snapshot: CacheAtomicSnapshot | null;
316
- readonly revision: string;
317
- } | {
318
- readonly op: 'invalidate';
327
+ }
328
+ /** Moves the tag index aside under `retired` and advances the fence: every
329
+ * entry of the tag stops being readable in this one transition. */
330
+ | {
331
+ readonly op: 'retire';
332
+ readonly tag: string;
333
+ readonly retired: string;
334
+ }
335
+ /** The first `count` memberships of a retired tag index. */
336
+ | {
337
+ readonly op: 'retired';
338
+ readonly tag: string;
339
+ readonly retired: string;
340
+ readonly count: number;
341
+ }
342
+ /** Deletes the observed entries of a retired tag index and drops those memberships. */
343
+ | {
344
+ readonly op: 'purge';
319
345
  readonly tag: string;
346
+ readonly retired: string;
320
347
  readonly members: ReadonlyArray<string>;
321
348
  readonly snapshots: ReadonlyArray<CacheAtomicValueSnapshot>;
322
- readonly revision: string;
323
- } | {
349
+ }
350
+ /** Advances the namespace generation: every earlier entry stops being readable. */
351
+ | {
324
352
  readonly op: 'clear';
325
- readonly keys: ReadonlyArray<string>;
326
- readonly revision: string | null;
353
+ }
354
+ /** Deletes observed entries that can no longer be read and retired tag indexes. */
355
+ | {
356
+ readonly op: 'sweep';
357
+ readonly snapshots: ReadonlyArray<CacheAtomicValueSnapshot>;
358
+ readonly retired: ReadonlyArray<string>;
327
359
  };
328
360
 
329
361
  /** JSON before UTF-8 preserves distinct JS strings containing lone surrogates. */
@@ -355,12 +387,24 @@ export declare interface CacheAtomicReply {
355
387
  readonly value: unknown;
356
388
  }
357
389
 
390
+ /** A retired tag index reference: the retirement identity, then the tag. */
391
+ export declare const cacheAtomicRetired: (retirement: string, tag: string) => string;
392
+
358
393
  /** Every cache namespace owns one Redis Cluster hash slot. */
359
394
  export declare const cacheAtomicRoot: (prefix: string) => string;
360
395
 
396
+ /**
397
+ * One SCAN page, classified. Only entries (`:v:`) and retired tag indexes
398
+ * (`:d:`) are reclaimable. Live tag indexes shrink as their entries go; the
399
+ * fence (`:s`, `:e:`) and the generation (`:g`) outlive every clear on purpose:
400
+ * dropping the fence would let a compute that observed the sequence before an
401
+ * invalidation store after it, and dropping the generation would make every
402
+ * cleared entry readable again.
403
+ */
361
404
  export declare const cacheAtomicScanPage: (root: string, input: unknown) => {
362
405
  readonly cursor: string;
363
- readonly keys: ReadonlyArray<string>;
406
+ readonly values: ReadonlyArray<string>;
407
+ readonly retired: ReadonlyArray<string>;
364
408
  };
365
409
 
366
410
  export declare interface CacheAtomicSnapshot {
@@ -442,7 +486,7 @@ export declare interface ConnectionPoolSnapshot {
442
486
  readonly source: 'config' | 'environment' | 'override';
443
487
  readonly label?: string;
444
488
  readonly region?: string;
445
- readonly persistence?: RedisConnectionConfig['persistence'];
489
+ readonly persistence?: NonNullable<RedisConnectionConfig['persistence']>;
446
490
  }
447
491
 
448
492
  /** Borrowed Pub/Sub port. A consumer owns registrations, never broker sockets. */
@@ -8,15 +8,15 @@ import { createNativeRedisConnection as _, disconnectNativeRedis as v, nativeRed
8
8
  import { connectRedisSubscriber as x } from "./connectionSubscriber.js";
9
9
  import { dynamicStorage as S } from "./connectionStorageConfig.js";
10
10
  import { withConnectionRegistryConfigProvider as C } from "./connectionConfigProvider.js";
11
- import { ConnectionRegistry as ee, layerConfiguredConnections as w, makeConnectionRegistry as T } from "./connectionPool.js";
11
+ import { ConnectionRegistry as w, layerConfiguredConnections as ee, makeConnectionRegistry as T } from "./connectionPool.js";
12
12
  import { httpRedisReaders as E } from "./redisReadPolicy.js";
13
13
  import { nativeRedisReadConfigs as D, openNativeRedisReaders as te } from "./nativeRedisReads.js";
14
14
  import { readRedisNodeDiagnostics as ne } from "./redisDiagnostics.js";
15
- import { CACHE_FENCE_RETENTION_MS as re, CacheAtomicProtocolError as ie, cacheAtomicArray as ae, cacheAtomicComponent as oe, cacheAtomicKeys as se, cacheAtomicMember as ce, cacheAtomicMembership as O, cacheAtomicRoot as k, cacheAtomicScanPage as A, cacheAtomicSnapshot as j, cacheAtomicTtl as M, cacheAtomicValueSnapshots as N, decodeCacheAtomicCommand as P, decodeCacheAtomicPolicy as F, decodeCacheAtomicReply as I, isCacheAtomicRead as L } from "./cacheAtomicProtocol.js";
16
- import { CACHE_ATOMIC_SCRIPT as R } from "./cacheAtomicScript.js";
17
- import { Config as z, ConfigProvider as B, Context as V, Effect as H, Layer as U, Option as W, Schedule as G } from "effect";
15
+ import { CACHE_ATOMIC_PAGE as re, CACHE_ATOMIC_SCAN as ie, CACHE_FENCE_RETENTION_MS as ae, CacheAtomicProtocolError as oe, cacheAtomicArray as se, cacheAtomicComponent as ce, cacheAtomicKeys as le, cacheAtomicMember as O, cacheAtomicMembership as k, cacheAtomicRetired as A, cacheAtomicRoot as j, cacheAtomicScanPage as M, cacheAtomicSnapshot as N, cacheAtomicTtl as P, cacheAtomicValueSnapshots as F, decodeCacheAtomicCommand as I, decodeCacheAtomicPolicy as L, decodeCacheAtomicReply as R, isCacheAtomicRead as z } from "./cacheAtomicProtocol.js";
16
+ import { CACHE_ATOMIC_SCRIPT as B } from "./cacheAtomicScript.js";
17
+ import { Config as V, ConfigProvider as H, Context as ue, Effect as U, Layer as de, Option as W, Schedule as G } from "effect";
18
18
  // src/connection.ts
19
- var K = (e) => new z.ConfigError(new B.SourceError({ message: e })), le = (e, t) => {
19
+ var K = (e) => new V.ConfigError(new H.SourceError({ message: e })), fe = (e, t) => {
20
20
  let n = e.client;
21
21
  return {
22
22
  readOnly: {
@@ -155,7 +155,7 @@ var K = (e) => new z.ConfigError(new B.SourceError({ message: e })), le = (e, t)
155
155
  if (e.maxmemoryPolicyHint !== void 0 && typeof e.maxmemoryPolicyHint != "string") return "Redis maxmemoryPolicyHint must be a string";
156
156
  }, X = (e) => {
157
157
  let t = Y(e);
158
- return t ? H.fail(K(t)) : e.driver === "resp" ? H.try({
158
+ return t ? U.fail(K(t)) : e.driver === "resp" ? U.try({
159
159
  try: () => {
160
160
  let t = y(e);
161
161
  if (D(e), e.readFrom === "replica" && t.kind === "standalone" && !e.replicas?.length) throw Error("Standalone replica reads require replica endpoints");
@@ -165,9 +165,9 @@ var K = (e) => new z.ConfigError(new B.SourceError({ message: e })), le = (e, t)
165
165
  } : e;
166
166
  },
167
167
  catch: () => K("Invalid native Redis topology declaration")
168
- }) : H.succeed(e);
169
- }, Z = ["resp", "http"], ue = (e, t = {}) => H.gen(function* () {
170
- let n = J(e), r = t.url ?? (yield* z.String(`${n}_REDIS_URL`).pipe(z.orElse(() => z.String("REDIS_URL")))), i = t.driver === void 0 ? yield* z.Literals(Z, `${n}_REDIS_DRIVER`).pipe(z.option) : W.none(), a = t.driver ?? (W.isSome(i) ? i.value : yield* z.Literals(Z, "REDIS_DRIVER").pipe(z.withDefault("resp"))), o = t.token === void 0 ? yield* z.String(`${n}_REDIS_TOKEN`).pipe(z.orElse(() => z.String("REDIS_TOKEN")), z.orElse(() => z.String("UPSTASH_REDIS_REST_TOKEN")), z.option) : W.some(t.token), s = t.keyPrefix === void 0 ? yield* z.String(`${n}_REDIS_KEY_PREFIX`).pipe(z.option) : W.some(t.keyPrefix);
168
+ }) : U.succeed(e);
169
+ }, Z = ["resp", "http"], Q = (e, t = {}) => U.gen(function* () {
170
+ let n = J(e), r = t.url ?? (yield* V.String(`${n}_REDIS_URL`).pipe(V.orElse(() => V.String("REDIS_URL")))), i = t.driver === void 0 ? yield* V.Literals(Z, `${n}_REDIS_DRIVER`).pipe(V.option) : W.none(), a = t.driver ?? (W.isSome(i) ? i.value : yield* V.Literals(Z, "REDIS_DRIVER").pipe(V.withDefault("resp"))), o = t.token === void 0 ? yield* V.String(`${n}_REDIS_TOKEN`).pipe(V.orElse(() => V.String("REDIS_TOKEN")), V.orElse(() => V.String("UPSTASH_REDIS_REST_TOKEN")), V.option) : W.some(t.token), s = t.keyPrefix === void 0 ? yield* V.String(`${n}_REDIS_KEY_PREFIX`).pipe(V.option) : W.some(t.keyPrefix);
171
171
  return {
172
172
  url: r,
173
173
  driver: a,
@@ -177,18 +177,18 @@ var K = (e) => new z.ConfigError(new B.SourceError({ message: e })), le = (e, t)
177
177
  ...t.connectTimeoutMs === void 0 ? {} : { connectTimeoutMs: t.connectTimeoutMs },
178
178
  ...t.commandTimeoutMs === void 0 ? {} : { commandTimeoutMs: t.commandTimeoutMs }
179
179
  };
180
- }).pipe(H.flatMap(X));
181
- function Q(e, t, n) {
180
+ }).pipe(U.flatMap(X));
181
+ function pe(e, t, n) {
182
182
  let r = n === void 0 ? void 0 : Object.freeze({ tenantId: n.tenantId });
183
- return H.gen(function* () {
183
+ return U.gen(function* () {
184
184
  let n = a(t ?? {});
185
- if (n) return yield* H.fail(K(n));
185
+ if (n) return yield* U.fail(K(n));
186
186
  let i = e.includes(":"), o = i ? e.slice(e.indexOf(":") + 1) : e;
187
- if (i && !e.startsWith("redis:")) return yield* H.fail(K("A Redis consumer requires a redis:name connection reference"));
188
- if (i && o && !/^[A-Za-z][A-Za-z0-9_-]*$/.test(o)) return yield* H.fail(K("Malformed Redis connection reference"));
187
+ if (i && !e.startsWith("redis:")) return yield* U.fail(K("A Redis consumer requires a redis:name connection reference"));
188
+ if (i && o && !/^[A-Za-z][A-Za-z0-9_-]*$/.test(o)) return yield* U.fail(K("Malformed Redis connection reference"));
189
189
  let s = t?.redis ?? {}, c = Object.keys(s), l = f(o, t ?? {}), u = Object.hasOwn(s, l) ? s[l] : void 0;
190
- if (!u && c.length > 0) return yield* H.fail(K(`Unknown Redis connection ${l || "(default)"}. Known names: ${c.sort().join(", ") || "(none)"}`));
191
- let d = `CONNECTIONS_REDIS_${J(l)}`, p = yield* z.String(`${d}_URL`).pipe(z.option), m = yield* z.Literals(["resp", "http"], `${d}_DRIVER`).pipe(z.option), h = yield* z.String(`${d}_TOKEN`).pipe(z.option), g = yield* z.String(`${d}_KEY_PREFIX`).pipe(z.option), _ = {
190
+ if (!u && c.length > 0) return yield* U.fail(K(`Unknown Redis connection ${l || "(default)"}. Known names: ${c.sort().join(", ") || "(none)"}`));
191
+ let d = `CONNECTIONS_REDIS_${J(l)}`, p = yield* V.String(`${d}_URL`).pipe(V.option), m = yield* V.Literals(["resp", "http"], `${d}_DRIVER`).pipe(V.option), h = yield* V.String(`${d}_TOKEN`).pipe(V.option), g = yield* V.String(`${d}_KEY_PREFIX`).pipe(V.option), _ = {
192
192
  ...W.isSome(p) ? { url: p.value } : {},
193
193
  ...W.isSome(m) ? { driver: m.value } : {},
194
194
  ...W.isSome(h) ? { token: h.value } : {},
@@ -205,26 +205,26 @@ function Q(e, t, n) {
205
205
  m,
206
206
  h,
207
207
  g
208
- ].some(W.isSome) ? yield* H.fail(K("A local memory connection cannot be redirected by transport environment overrides")) : {
208
+ ].some(W.isSome) ? yield* U.fail(K("A local memory connection cannot be redirected by transport environment overrides")) : {
209
209
  url: `memory:${l}`,
210
210
  driver: "memory",
211
211
  source: "config",
212
212
  ...u.now === void 0 ? {} : { memoryClock: u.now }
213
213
  };
214
214
  if (u && "_tag" in u) {
215
- if (!r?.tenantId) return yield* H.fail(K("A dynamic Redis connection requires tenantId"));
215
+ if (!r?.tenantId) return yield* U.fail(K("A dynamic Redis connection requires tenantId"));
216
216
  let e = {
217
217
  ...yield* u.resolve(r),
218
218
  ..._
219
219
  }, t = Y(e);
220
- return t ? yield* H.fail(K(t)) : e.driver === "memory" ? yield* H.fail(K("Local memory connections require a memory() declaration, not a tenant credential resolver")) : e.keyPrefix !== void 0 && typeof e.keyPrefix != "string" ? yield* H.fail(K("Connection keyPrefix must be a string")) : e.allowSharedNamespace !== void 0 && typeof e.allowSharedNamespace != "boolean" ? yield* H.fail(K("Connection allowSharedNamespace must be a boolean")) : e.driver === "http" && !e.token ? yield* H.fail(K("An HTTP Redis connection requires a declared token")) : e.tls === "required" && !/^rediss(?:\+cluster|\+sentinel)?:\/\//i.test(e.url) && !(e.driver === "http" && /^https:\/\//i.test(e.url)) ? yield* H.fail(K("A Redis connection with tls: required needs a secure Redis scheme or HTTPS")) : yield* X(e);
220
+ return t ? yield* U.fail(K(t)) : e.driver === "memory" ? yield* U.fail(K("Local memory connections require a memory() declaration, not a tenant credential resolver")) : e.keyPrefix !== void 0 && typeof e.keyPrefix != "string" ? yield* U.fail(K("Connection keyPrefix must be a string")) : e.allowSharedNamespace !== void 0 && typeof e.allowSharedNamespace != "boolean" ? yield* U.fail(K("Connection allowSharedNamespace must be a boolean")) : e.driver === "http" && !e.token ? yield* U.fail(K("An HTTP Redis connection requires a declared token")) : e.tls === "required" && !/^rediss(?:\+cluster|\+sentinel)?:\/\//i.test(e.url) && !(e.driver === "http" && /^https:\/\//i.test(e.url)) ? yield* U.fail(K("A Redis connection with tls: required needs a secure Redis scheme or HTTPS")) : yield* X(e);
221
221
  }
222
- if (!u) return yield* ue(l || e, _);
223
- let v = W.isSome(p) ? p.value : yield* z.String(u.url.name), y = W.isSome(m) ? m.value : u.driver ?? "resp", b = W.isSome(h) ? W.some(h.value) : u.token ? W.some(yield* z.String(u.token.name)) : W.none();
224
- if (y === "http" && W.isNone(b)) return yield* H.fail(K("An HTTP Redis connection requires a declared token"));
222
+ if (!u) return yield* Q(l || e, _);
223
+ let v = W.isSome(p) ? p.value : yield* V.String(u.url.name), y = W.isSome(m) ? m.value : u.driver ?? "resp", b = W.isSome(h) ? W.some(h.value) : u.token ? W.some(yield* V.String(u.token.name)) : W.none();
224
+ if (y === "http" && W.isNone(b)) return yield* U.fail(K("An HTTP Redis connection requires a declared token"));
225
225
  let x = W.isSome(g) ? g.value : u.keyPrefix, S = u.cluster ?? /^rediss?\+cluster:\/\//i.test(v);
226
- if (u.tls === "required" && !/^rediss(?:\+cluster|\+sentinel)?:\/\//i.test(v) && !(y === "http" && /^https:\/\//i.test(v))) return yield* H.fail(K("A Redis connection with tls: required needs a secure Redis scheme or HTTPS"));
227
- let C = yield* H.forEach(u.replicas ?? [], (e) => z.String(e.name));
226
+ if (u.tls === "required" && !/^rediss(?:\+cluster|\+sentinel)?:\/\//i.test(v) && !(y === "http" && /^https:\/\//i.test(v))) return yield* U.fail(K("A Redis connection with tls: required needs a secure Redis scheme or HTTPS"));
227
+ let C = yield* U.forEach(u.replicas ?? [], (e) => V.String(e.name));
228
228
  return yield* X({
229
229
  url: v,
230
230
  driver: y,
@@ -251,7 +251,7 @@ function Q(e, t, n) {
251
251
  });
252
252
  });
253
253
  }
254
- var de = (n) => H.tryPromise({
254
+ var me = (n) => U.tryPromise({
255
255
  try: async (e) => {
256
256
  e.throwIfAborted();
257
257
  let t = Y(n);
@@ -348,7 +348,7 @@ var de = (n) => H.tryPromise({
348
348
  try {
349
349
  let t = await te(n, r, e);
350
350
  try {
351
- return e.throwIfAborted(), le(r, t);
351
+ return e.throwIfAborted(), fe(r, t);
352
352
  } catch (e) {
353
353
  throw await t.close(), e;
354
354
  }
@@ -361,5 +361,5 @@ var de = (n) => H.tryPromise({
361
361
  key: "",
362
362
  cause: n.keyPrefix !== void 0 && typeof n.keyPrefix != "string" ? "Connection keyPrefix must be a string" : "Redis connection could not be opened"
363
363
  })
364
- }).pipe(H.map((e) => t(e, n.keyPrefix))), fe = G.max([G.exponential("10 millis"), G.recurs(2)]), $ = class extends V.Service()("@voltro/RedisConnections") {}, pe = U.effect($, H.suspend(() => T()).pipe(H.orDie, H.map((e) => e.redis)));
365
- export { R as CACHE_ATOMIC_SCRIPT, re as CACHE_FENCE_RETENTION_MS, ie as CacheAtomicProtocolError, ee as ConnectionRegistry, $ as RedisConnections, i as byTenant, ae as cacheAtomicArray, oe as cacheAtomicComponent, se as cacheAtomicKeys, ce as cacheAtomicMember, O as cacheAtomicMembership, k as cacheAtomicRoot, A as cacheAtomicScanPage, j as cacheAtomicSnapshot, M as cacheAtomicTtl, N as cacheAtomicValueSnapshots, fe as commandRetry, de as connect, x as connectRedisSubscriber, Q as connectionConfig, a as connectionDefinitionsProblem, s as declaredConnectionEnv, P as decodeCacheAtomicCommand, F as decodeCacheAtomicPolicy, I as decodeCacheAtomicReply, c as dynamic, r as dynamicAnalytics, l as dynamicNats, n as dynamicSql, S as dynamicStorage, u as env, L as isCacheAtomicRead, w as layerConfiguredConnections, pe as layerConnections, T as makeConnectionRegistry, d as memory, m as roundRobin, h as shardBy, C as withConnectionRegistryConfigProvider };
364
+ }).pipe(U.map((e) => t(e, n.keyPrefix))), he = G.max([G.exponential("10 millis"), G.recurs(2)]), $ = class extends ue.Service()("@voltro/RedisConnections") {}, ge = de.effect($, U.suspend(() => T()).pipe(U.orDie, U.map((e) => e.redis)));
365
+ export { re as CACHE_ATOMIC_PAGE, ie as CACHE_ATOMIC_SCAN, B as CACHE_ATOMIC_SCRIPT, ae as CACHE_FENCE_RETENTION_MS, oe as CacheAtomicProtocolError, w as ConnectionRegistry, $ as RedisConnections, i as byTenant, se as cacheAtomicArray, ce as cacheAtomicComponent, le as cacheAtomicKeys, O as cacheAtomicMember, k as cacheAtomicMembership, A as cacheAtomicRetired, j as cacheAtomicRoot, M as cacheAtomicScanPage, N as cacheAtomicSnapshot, P as cacheAtomicTtl, F as cacheAtomicValueSnapshots, he as commandRetry, me as connect, x as connectRedisSubscriber, pe as connectionConfig, a as connectionDefinitionsProblem, s as declaredConnectionEnv, I as decodeCacheAtomicCommand, L as decodeCacheAtomicPolicy, R as decodeCacheAtomicReply, c as dynamic, r as dynamicAnalytics, l as dynamicNats, n as dynamicSql, S as dynamicStorage, u as env, z as isCacheAtomicRead, ee as layerConfiguredConnections, ge as layerConnections, T as makeConnectionRegistry, d as memory, m as roundRobin, h as shardBy, C as withConnectionRegistryConfigProvider };
@@ -6,6 +6,23 @@ import { Schema } from 'effect';
6
6
  import { Stream } from 'effect';
7
7
  import { YieldableError } from 'effect/Cause';
8
8
 
9
+ /** Tag and replacement path. A replacement backend proves itself with
10
+ * `conformance`, the same suite the memory and Redis backends run. */
11
+ export declare const hotBackendPortFixture: {
12
+ kind: "port";
13
+ tag: typeof HotStore;
14
+ fakeLayer: Layer.Layer<HotStore, HotError, never>;
15
+ conformance: (name: string, fixture: () => HotConformanceFixture, tests: HotConformanceTestApi) => void;
16
+ probe: {
17
+ run: () => Effect.Effect<number, HotError, never>;
18
+ expected: number;
19
+ };
20
+ overrideProbe: {
21
+ run: () => Effect.Effect<number, HotError, never>;
22
+ expected: number;
23
+ };
24
+ };
25
+
9
26
  declare interface HotBucketConfig {
10
27
  readonly capacity: number;
11
28
  readonly refillPerSec: number;
@@ -193,6 +210,9 @@ declare const HotStore_base: Context.ServiceClass<HotStore, "@voltro/HotStore",
193
210
  /** Run exactly the same behavioral contract against a backend or a replacement port. */
194
211
  export declare const hotStoreConformance: (name: string, fixture: () => HotConformanceFixture, tests: HotConformanceTestApi) => void;
195
212
 
213
+ /** The in-memory backend: one fresh store per provided scope. */
214
+ export declare const hotStoreFakeLayer: Layer.Layer<HotStore, HotError>;
215
+
196
216
  declare interface HotStoreShape {
197
217
  readonly zadd: (key: string, members: ReadonlyArray<HotMember>, options?: HotZaddOptions) => Effect.Effect<void, HotError>;
198
218
  readonly zrem: (key: string, members: ReadonlyArray<string>) => Effect.Effect<number, HotError>;
@@ -1 +1,3 @@
1
- export { hotStoreConformance } from "./hotStoreConformance.js";
1
+ import { hotStoreConformance as e } from "./hotStoreConformance.js";
2
+ import { hotBackendPortFixture as t, hotStoreFakeLayer as n } from "./hotStoreFixtures.js";
3
+ export { t as hotBackendPortFixture, e as hotStoreConformance, n as hotStoreFakeLayer };
package/dist/hot.d.ts CHANGED
@@ -280,7 +280,7 @@ declare interface ConnectionPoolSnapshot {
280
280
  readonly source: 'config' | 'environment' | 'override';
281
281
  readonly label?: string;
282
282
  readonly region?: string;
283
- readonly persistence?: RedisConnectionConfig['persistence'];
283
+ readonly persistence?: NonNullable<RedisConnectionConfig['persistence']>;
284
284
  }
285
285
 
286
286
  /** Borrowed Pub/Sub port. A consumer owns registrations, never broker sockets. */
@@ -608,6 +608,22 @@ export declare interface HotStoreShape {
608
608
  };
609
609
  }
610
610
 
611
+ /** Inventory of the hot store's replaceable part as actual exports: the backend
612
+ * behind the `HotStore` Tag. `hotSystemManifest.test.ts` runs the fixture and
613
+ * the shared conformance suite against a replacement. Routing is an option of
614
+ * `layerRoutedHotRedis`, not a slot. */
615
+ export declare const hotStoreSystemContractManifest: Readonly<{
616
+ slots: Readonly<{}>;
617
+ ports: Readonly<{
618
+ backend: Readonly<{
619
+ tagExport: "HotStore";
620
+ fakeLayerExport: "hotStoreFakeLayer";
621
+ fixtureExport: "hotBackendPortFixture";
622
+ }>;
623
+ }>;
624
+ events: readonly string[];
625
+ }>;
626
+
611
627
  export declare interface HotTtl {
612
628
  readonly ttlMs?: number;
613
629
  }
package/dist/hot.js CHANGED
@@ -4,4 +4,5 @@ import { HotError as n, HotStore as r } from "./hot-contract.js";
4
4
  import { HOT_MEMORY_DEFAULTS as i, layerHotMemory as a, makeMemoryHotStore as o } from "./hotMemory.js";
5
5
  import { HOT_REDIS_DEFAULTS as s, layerHotRedis as c, makeRedisHotStore as l } from "./hotRedis.js";
6
6
  import { layerRoutedHotRedis as u } from "./hotRouting.js";
7
- export { i as HOT_MEMORY_DEFAULTS, s as HOT_REDIS_DEFAULTS, n as HotError, r as HotStore, e as consumeHotRateLimit, a as layerHotMemory, c as layerHotRedis, u as layerRoutedHotRedis, o as makeMemoryHotStore, l as makeRedisHotStore, t as readHotStoreWithFallback };
7
+ import { hotStoreSystemContractManifest as d } from "./hotSystemManifest.js";
8
+ export { i as HOT_MEMORY_DEFAULTS, s as HOT_REDIS_DEFAULTS, n as HotError, r as HotStore, e as consumeHotRateLimit, d as hotStoreSystemContractManifest, a as layerHotMemory, c as layerHotRedis, u as layerRoutedHotRedis, o as makeMemoryHotStore, l as makeRedisHotStore, t as readHotStoreWithFallback };
@@ -0,0 +1,23 @@
1
+ import { HotStore as e } from "./hot-contract.js";
2
+ import { layerHotMemory as t, makeMemoryHotStore as n } from "./hotMemory.js";
3
+ import { hotStoreConformance as r } from "./hotStoreConformance.js";
4
+ import { Effect as i, Layer as a } from "effect";
5
+ // src/hotStoreFixtures.ts
6
+ var o = t(), s = (t) => e.pipe(i.flatMap((e) => e.incrBy("fixture:counter", 2)), i.provide(t)), c = {
7
+ kind: "port",
8
+ tag: e,
9
+ fakeLayer: o,
10
+ conformance: r,
11
+ probe: {
12
+ run: () => s(o),
13
+ expected: 2
14
+ },
15
+ overrideProbe: {
16
+ run: () => s(a.effect(e, i.map(n(), (e) => ({
17
+ ...e,
18
+ incrBy: (t, n, r) => e.incrBy(t, n * 10, r)
19
+ })))),
20
+ expected: 20
21
+ }
22
+ };
23
+ export { c as hotBackendPortFixture, o as hotStoreFakeLayer };
@@ -0,0 +1,11 @@
1
+ // src/hotSystemManifest.ts
2
+ var e = Object.freeze({
3
+ slots: Object.freeze({}),
4
+ ports: Object.freeze({ backend: Object.freeze({
5
+ tagExport: "HotStore",
6
+ fakeLayerExport: "hotStoreFakeLayer",
7
+ fixtureExport: "hotBackendPortFixture"
8
+ }) }),
9
+ events: Object.freeze([])
10
+ });
11
+ export { e as hotStoreSystemContractManifest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/kv",
3
- "version": "0.89.1",
3
+ "version": "0.90.0",
4
4
  "description": "Named RESP connection registry + durable key-value primitive. One config surface for many Redis-family connections (Redis/Valkey/KeyDB/Dragonfly/Upstash) shared across cache, rate-limit, RYW and broadcast; plus a durable, tenant-scoped KV store distinct from the best-effort cache.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -68,7 +68,7 @@
68
68
  "node": ">=24.0.0"
69
69
  },
70
70
  "dependencies": {
71
- "@voltro/shared": "0.89.1"
71
+ "@voltro/shared": "0.90.0"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "effect": "4.1.2",