Documentation
¶
Overview ¶
Package goresp is the module root for a stream-agnostic RESP (Redis Serialization Protocol) parser and a self-healing Redis pub/sub connector.
It has no external dependencies and does no logging. The functionality lives in subpackages:
- github.com/iceisfun/goresp/resp: streaming, resumable RESP wire codec. Feed it bytes from any source (a socket, a file, a fixture) and pull complete values, resuming cleanly when the stream starves mid-value.
- github.com/iceisfun/goresp/connection: self-healing pub/sub client. Delivers decoded messages to an injected Handler and lifecycle/errors to an injected EventHandler, with automatic reconnect and resubscribe.
- github.com/iceisfun/goresp/command: RESP command framing.
- github.com/iceisfun/goresp/publish: producer-side helper that owns a dedicated (non-subscribed) connection.
The runnable examples directory walks from a minimal subscriber to a high-throughput worker pool.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
goresp
command
Command goresp is a small example consumer: it subscribes to one or more channels and prints each message.
|
Command goresp is a small example consumer: it subscribes to one or more channels and prints each message. |
|
Package command formats Redis commands on the wire as RESP arrays of bulk strings, the form a Redis server expects for inline commands such as SUBSCRIBE, PUBLISH, and PING.
|
Package command formats Redis commands on the wire as RESP arrays of bulk strings, the form a Redis server expects for inline commands such as SUBSCRIBE, PUBLISH, and PING. |
|
Package connection provides a self-healing Redis pub/sub client.
|
Package connection provides a self-healing Redis pub/sub client. |
|
examples
|
|
|
01-subscribe
command
Beginner: subscribe to a channel and print every message.
|
Beginner: subscribe to a channel and print every message. |
|
02-json
command
Beginner+: decode JSON payloads into a struct.
|
Beginner+: decode JSON payloads into a struct. |
|
03-reconnect-events
command
Intermediate: lifecycle events and reconnect-safe subscriptions.
|
Intermediate: lifecycle events and reconnect-safe subscriptions. |
|
04-publish
command
Intermediate: publish messages.
|
Intermediate: publish messages. |
|
05-graceful-shutdown
command
Intermediate: graceful shutdown with context.
|
Intermediate: graceful shutdown with context. |
|
06-replay-from-disk
command
Advanced: replay a captured stream from disk (no Redis required).
|
Advanced: replay a captured stream from disk (no Redis required). |
|
07-worker-pool
command
Advanced: decouple processing with a worker pool for high throughput.
|
Advanced: decouple processing with a worker pool for high throughput. |
|
08-publish-confirm
command
Advanced: confirmed publish — get the subscriber count back.
|
Advanced: confirmed publish — get the subscriber count back. |
|
Package publish is the producer side of goresp.
|
Package publish is the producer side of goresp. |
|
Package resp implements the Redis Serialization Protocol (RESP) wire format as a streaming, resumable codec.
|
Package resp implements the Redis Serialization Protocol (RESP) wire format as a streaming, resumable codec. |
Click to show internal directories.
Click to hide internal directories.