@rljson/server 0.0.7 → 0.0.8
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.architecture.md +2 -0
- package/README.public.md +11 -8
- package/dist/README.architecture.md +2 -0
- package/dist/README.public.md +11 -8
- package/package.json +1 -1
package/README.architecture.md
CHANGED
|
@@ -134,6 +134,8 @@ The `Server` class acts as a central coordination point that:
|
|
|
134
134
|
- Broadcasts notifications between clients
|
|
135
135
|
- Provides read access to its own local storage
|
|
136
136
|
|
|
137
|
+
**Relay mode (`disableLocalCache: true`):** When the `disableLocalCache` option is set, the server omits the local IoMem/BsMem from its IoMulti/BsMulti stacks. In this mode the server reads all data exclusively from connected client peers, acting as a pure relay without caching any data locally. This is useful for memory-constrained deployments where the server should not retain copies of client data.
|
|
138
|
+
|
|
137
139
|
**Data Flow Architecture:**
|
|
138
140
|
|
|
139
141
|
```text
|
package/README.public.md
CHANGED
|
@@ -176,6 +176,7 @@ This is implemented with `IoMulti` and `BsMulti` internally, but the public API
|
|
|
176
176
|
- `bs` – Bs interface used by server
|
|
177
177
|
- `clients` – `Map` of connected clients (keyed by internal clientId)
|
|
178
178
|
- `isTornDown` – whether the server has been shut down
|
|
179
|
+
- `isLocalCacheDisabled` – whether local caching is disabled (pure relay mode)
|
|
179
180
|
- `logger` – the `ServerLogger` instance (defaults to `noopLogger`)
|
|
180
181
|
|
|
181
182
|
## Example
|
|
@@ -306,17 +307,19 @@ const server = new Server(route, io, bs, {
|
|
|
306
307
|
logger: new ConsoleLogger(), // Structured logging (default: NoopLogger)
|
|
307
308
|
refEvictionIntervalMs: 60_000, // Ref dedup sweep interval (default: 60 s, 0 = disable)
|
|
308
309
|
peerInitTimeoutMs: 30_000, // Peer handshake timeout (default: 30 s, 0 = disable)
|
|
310
|
+
disableLocalCache: true, // Pure relay mode — no local Io/Bs cache (default: false)
|
|
309
311
|
});
|
|
310
312
|
```
|
|
311
313
|
|
|
312
|
-
| Option | Default | Description
|
|
313
|
-
| ----------------------- | ---------- |
|
|
314
|
-
| `logger` | NoopLogger | Structured logger for lifecycle, traffic, and error events.
|
|
315
|
-
| `refEvictionIntervalMs` | 60 000 | Two-generation sweep interval for multicast ref dedup. Refs older than two intervals are forgotten, preventing unbounded memory growth.
|
|
316
|
-
| `peerInitTimeoutMs` | 30 000 | Maximum time `addSocket()` waits for a peer to initialize. Prevents hanging on unresponsive clients.
|
|
317
|
-
| `syncConfig` | undefined | Sync protocol configuration (see below). Enables ACK aggregation, gap-fill, and enriched payloads.
|
|
318
|
-
| `refLogSize` | 1 000 | Maximum number of recent payloads retained in the ref log for gap-fill responses.
|
|
319
|
-
| `ackTimeoutMs` | 10 000 | Timeout for collecting individual client ACKs before emitting the aggregated ACK. Falls back to `syncConfig.ackTimeoutMs`.
|
|
314
|
+
| Option | Default | Description |
|
|
315
|
+
| ----------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
316
|
+
| `logger` | NoopLogger | Structured logger for lifecycle, traffic, and error events. |
|
|
317
|
+
| `refEvictionIntervalMs` | 60 000 | Two-generation sweep interval for multicast ref dedup. Refs older than two intervals are forgotten, preventing unbounded memory growth. |
|
|
318
|
+
| `peerInitTimeoutMs` | 30 000 | Maximum time `addSocket()` waits for a peer to initialize. Prevents hanging on unresponsive clients. |
|
|
319
|
+
| `syncConfig` | undefined | Sync protocol configuration (see below). Enables ACK aggregation, gap-fill, and enriched payloads. |
|
|
320
|
+
| `refLogSize` | 1 000 | Maximum number of recent payloads retained in the ref log for gap-fill responses. |
|
|
321
|
+
| `ackTimeoutMs` | 10 000 | Timeout for collecting individual client ACKs before emitting the aggregated ACK. Falls back to `syncConfig.ackTimeoutMs`. |
|
|
322
|
+
| `disableLocalCache` | false | When true, the server skips creating local IoMem/BsMem caches. The server acts as a pure relay, reading data only from connected client peers. Useful for memory-constrained deployments. |
|
|
320
323
|
|
|
321
324
|
## Client options
|
|
322
325
|
|
|
@@ -134,6 +134,8 @@ The `Server` class acts as a central coordination point that:
|
|
|
134
134
|
- Broadcasts notifications between clients
|
|
135
135
|
- Provides read access to its own local storage
|
|
136
136
|
|
|
137
|
+
**Relay mode (`disableLocalCache: true`):** When the `disableLocalCache` option is set, the server omits the local IoMem/BsMem from its IoMulti/BsMulti stacks. In this mode the server reads all data exclusively from connected client peers, acting as a pure relay without caching any data locally. This is useful for memory-constrained deployments where the server should not retain copies of client data.
|
|
138
|
+
|
|
137
139
|
**Data Flow Architecture:**
|
|
138
140
|
|
|
139
141
|
```text
|
package/dist/README.public.md
CHANGED
|
@@ -176,6 +176,7 @@ This is implemented with `IoMulti` and `BsMulti` internally, but the public API
|
|
|
176
176
|
- `bs` – Bs interface used by server
|
|
177
177
|
- `clients` – `Map` of connected clients (keyed by internal clientId)
|
|
178
178
|
- `isTornDown` – whether the server has been shut down
|
|
179
|
+
- `isLocalCacheDisabled` – whether local caching is disabled (pure relay mode)
|
|
179
180
|
- `logger` – the `ServerLogger` instance (defaults to `noopLogger`)
|
|
180
181
|
|
|
181
182
|
## Example
|
|
@@ -306,17 +307,19 @@ const server = new Server(route, io, bs, {
|
|
|
306
307
|
logger: new ConsoleLogger(), // Structured logging (default: NoopLogger)
|
|
307
308
|
refEvictionIntervalMs: 60_000, // Ref dedup sweep interval (default: 60 s, 0 = disable)
|
|
308
309
|
peerInitTimeoutMs: 30_000, // Peer handshake timeout (default: 30 s, 0 = disable)
|
|
310
|
+
disableLocalCache: true, // Pure relay mode — no local Io/Bs cache (default: false)
|
|
309
311
|
});
|
|
310
312
|
```
|
|
311
313
|
|
|
312
|
-
| Option | Default | Description
|
|
313
|
-
| ----------------------- | ---------- |
|
|
314
|
-
| `logger` | NoopLogger | Structured logger for lifecycle, traffic, and error events.
|
|
315
|
-
| `refEvictionIntervalMs` | 60 000 | Two-generation sweep interval for multicast ref dedup. Refs older than two intervals are forgotten, preventing unbounded memory growth.
|
|
316
|
-
| `peerInitTimeoutMs` | 30 000 | Maximum time `addSocket()` waits for a peer to initialize. Prevents hanging on unresponsive clients.
|
|
317
|
-
| `syncConfig` | undefined | Sync protocol configuration (see below). Enables ACK aggregation, gap-fill, and enriched payloads.
|
|
318
|
-
| `refLogSize` | 1 000 | Maximum number of recent payloads retained in the ref log for gap-fill responses.
|
|
319
|
-
| `ackTimeoutMs` | 10 000 | Timeout for collecting individual client ACKs before emitting the aggregated ACK. Falls back to `syncConfig.ackTimeoutMs`.
|
|
314
|
+
| Option | Default | Description |
|
|
315
|
+
| ----------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
316
|
+
| `logger` | NoopLogger | Structured logger for lifecycle, traffic, and error events. |
|
|
317
|
+
| `refEvictionIntervalMs` | 60 000 | Two-generation sweep interval for multicast ref dedup. Refs older than two intervals are forgotten, preventing unbounded memory growth. |
|
|
318
|
+
| `peerInitTimeoutMs` | 30 000 | Maximum time `addSocket()` waits for a peer to initialize. Prevents hanging on unresponsive clients. |
|
|
319
|
+
| `syncConfig` | undefined | Sync protocol configuration (see below). Enables ACK aggregation, gap-fill, and enriched payloads. |
|
|
320
|
+
| `refLogSize` | 1 000 | Maximum number of recent payloads retained in the ref log for gap-fill responses. |
|
|
321
|
+
| `ackTimeoutMs` | 10 000 | Timeout for collecting individual client ACKs before emitting the aggregated ACK. Falls back to `syncConfig.ackTimeoutMs`. |
|
|
322
|
+
| `disableLocalCache` | false | When true, the server skips creating local IoMem/BsMem caches. The server acts as a pure relay, reading data only from connected client peers. Useful for memory-constrained deployments. |
|
|
320
323
|
|
|
321
324
|
## Client options
|
|
322
325
|
|