@crvouga/mockingbird-service-redis 2.2.0 → 2.4.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.
package/README.md CHANGED
@@ -22,21 +22,33 @@ npm install -D @crvouga/mockingbird-service-redis
22
22
  ## Usage
23
23
 
24
24
  ```ts
25
+ import { Redis } from "ioredis"
25
26
  import { createRedis, manualClock } from "@crvouga/mockingbird-service-redis"
27
+ import { serve } from "@crvouga/mockingbird-service-redis/server"
26
28
 
27
- const clock = manualClock(1_700_000_000_000)
28
- const redis = createRedis({ clock })
29
- const client = redis.client()
30
- const set = await client.call("SET", "lock", "token", "PX", 1000)
31
- console.log(set)
32
- redis.advance(1000)
29
+ // Test setup: an emulator on a manual clock, listening on a free port. `as never` is needed
30
+ // because the two entry points bundle separate declarations of the `Redis` type.
31
+ const emulator = createRedis({ clock: manualClock(1_700_000_000_000) })
32
+ const server = await serve(emulator as never, { port: 0 })
33
+
34
+ // Application code: the ioredis client it already uses, connected to the emulator.
35
+ const redis = new Redis({ host: server.host, port: server.port })
36
+ console.log(await redis.set("lock", "token", "PX", 1000)) // OK
37
+
38
+ // Test control: expire the lock without sleeping.
39
+ emulator.advance(1000)
40
+ console.log(await redis.get("lock")) // null
41
+
42
+ await redis.quit()
43
+ await server.close()
33
44
  ```
34
45
 
35
46
  Two `createRedis()` instances never share keys. `SELECT` isolates logical databases 0–15 inside
36
- one instance. `redis.advance(ms)` moves an injected clock. `redis.inspect()`, `redis.fault()`,
37
- `redis.pauseConsumers()`, `redis.reset()`, and `redis.waiterCount()` are the test controls.
47
+ one instance. `emulator.advance(ms)` moves an injected clock. `emulator.inspect()`,
48
+ `emulator.fault()`, `emulator.pauseConsumers()`, `emulator.reset()`, and `emulator.waiterCount()`
49
+ are the test controls.
38
50
 
39
- `ioredis` can connect to the TCP server unchanged. Cluster `MOVED` / `ASK` is not implemented:
51
+ `ioredis` connects to the TCP server unchanged. Cluster `MOVED` / `ASK` is not implemented:
40
52
  `CLUSTER` and `READONLY` answer that cluster support is disabled.
41
53
 
42
54
  `mockingbird-redis serve --config mockingbird.json` supervises mixed HTTP/Postgres/Redis fleets.
package/SUPPORT.md CHANGED
@@ -28,3 +28,13 @@ against the emulator and an installed local `redis-server` (verified with Redis
28
28
 
29
29
  Out of scope: Redis Cluster, Redis 8 modules and a complete Lua 5.1 runtime. Compatibility claims
30
30
  are limited to the tested BullMQ flows rather than every arbitrary Lua program.
31
+
32
+ ## Fleet controls
33
+
34
+ The fleet adapter supports dynamic namespace listeners, finite numeric seeds, boot/reset clocks,
35
+ connection admission quotas, private pre-ready seeding listeners, bounded key/type/TTL inspection,
36
+ and portable `mockingbird.redis/v1` archives. Binary values, Maps, bigint stream ids, Lua scripts,
37
+ random state, consumer pause state and queued/delayed BullMQ work survive process replacement.
38
+ Live blocked/active work must drain before capture. Fleet latency/fault profiles are unsupported for
39
+ RESP children and are rejected explicitly. See [Fleets](../../../docs/FLEETS.md) and the adapter's
40
+ `fleet.management.test.ts` acceptance suite (real ioredis clients).