From d04341bfa2f708fce04de5df261766fe49009450 Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 26 May 2026 15:08:33 -0400 Subject: [PATCH] docs: update README, CONFIG, EXTEND for config/dialer refactoring --- CONFIG.md | 22 ++++++++++++++++------ EXTEND.md | 3 +-- README.md | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CONFIG.md b/CONFIG.md index 22ea42a..f7858f3 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -17,7 +17,7 @@ Logging can be controlled independently at the pool, worker, and connection leve | Connection | `ErrorsBufferSize` | 10 | — | Must be positive | | Connection | `LoggingEnabled` | true | `false` | | | Connection | `LogLevel` | nil | — | nil defers to handler's own filter | -| Retry | enabled | yes | `WithoutRetry()` | Governs `Connect()` only | +| Retry | enabled | yes | `WithRetryDisabled()` | Governs `Connect()` only | | Retry | `MaxRetries` | 0 | — | 0 means infinite | | Retry | `InitialDelay` | 1s | — | Must be positive | | Retry | `MaxDelay` | 60s | — | Must be ≥ InitialDelay | @@ -61,11 +61,16 @@ Sets the capacity of the channel that buffers inbound messages between the reade **`WithErrorsBufferSize(int)`** Sets the capacity of the channel that carries connection-level errors to the consumer. Must be at least 1. +### Dialer + +**`WithConnectionDialer(types.Dialer)`** +Overrides the dialer used to establish the WebSocket connection. When not set, the connection uses the default dialer. Useful in tests or when routing connections through a custom transport. + ### Retry The retry policy governs the `Connect()` call only. It does not affect worker reconnection, which is controlled by `ReconnectDelay` on the worker config. -**`WithoutRetry()`** +**`WithRetryDisabled()`** Disables retry entirely. `Connect()` returns on the first dial failure. **`WithRetryMaxRetries(int)`** @@ -124,13 +129,18 @@ Enables or disables worker-level logging. **`honeybee.WithWorkerLogLevel(slog.Level)`** Overrides the minimum log level for worker-scoped records only. +### Per-connection + +**`honeybee.WithDialer(types.Dialer)`** +Overrides the dialer for a single `Connect` call. Passed as a variadic option: `pool.Connect(id, honeybee.WithDialer(d))`. When provided, it takes precedence over the dialer resolved from `ConnectionConfig`. Existing callers that pass no options are unaffected. + ### Wiring -**`honeybee.WithConnectionConfig(*transport.ConnectionConfig)`** -Supplies a connection config used when dialing each peer. +**`honeybee.WithConnectionConfig(transport.ConnectionConfig)`** +Supplies a connection config used when dialing each peer. Accepted by value; the pool stores its own copy. -**`honeybee.WithWorkerConfig(*honeybee.WorkerConfig)`** -Supplies a worker config applied to every worker the pool creates. +**`honeybee.WithWorkerConfig(honeybee.WorkerConfig)`** +Supplies a worker config applied to every worker the pool creates. Accepted by value; the pool stores its own copy. **`honeybee.WithWorkerFactory(honeybee.WorkerFactory)`** Replaces the default worker constructor. See [EXTEND.md](EXTEND.md) for the factory contract. diff --git a/EXTEND.md b/EXTEND.md index 804e655..f81d785 100644 --- a/EXTEND.md +++ b/EXTEND.md @@ -35,8 +35,7 @@ type PoolPlugin struct { Inbox chan<- honeybee.InboxMessage Events chan<- honeybee.PoolEvent InboxCounter *atomic.Uint64 - Dialer honeybee.Dialer - ConnectionConfig *transport.ConnectionConfig + ConnectionConfig transport.ConnectionConfig Handler slog.Handler } ``` diff --git a/README.md b/README.md index b7b76a5..7399be3 100644 --- a/README.md +++ b/README.md @@ -240,7 +240,7 @@ Connections send periodic WebSocket ping frames and listen for the corresponding Pong-derived heartbeats reset the keepalive timer alongside data messages and sends. A peer that sends no data but responds to pings will not be disconnected and reconnected by the keepalive mechanism. -The ping interval is configured via `transport.WithPingInterval` on the `transport.ConnectionConfig`. Import `git.wisehodl.dev/jay/go-honeybee/transport` to construct a `ConnectionConfig`, then pass it to the pool via `honeybee.WithConnectionConfig`, or supply it directly to `NewConnection` and `NewConnectionFromSocket`. The default is 20 seconds. Set to zero to disable pings entirely, in which case only data messages and outbound sends generate heartbeats. +The ping interval is configured via `transport.WithPingInterval` on the `transport.ConnectionConfig`. Import `git.wisehodl.dev/jay/go-honeybee/transport` to construct a `ConnectionConfig`, then pass it to the pool by value via `honeybee.WithConnectionConfig`, or supply it directly to `NewConnection` and `NewConnectionFromSocket`. The default is 20 seconds. Set to zero to disable pings entirely, in which case only data messages and outbound sends generate heartbeats. ## Statistics