Documentation
¶
Overview ¶
Package zmqcat is a ZMQ-style mailbox bus over Tailcat.
One process serves (prints a tailcat token). Others join with that token. Local processes talk over a unix/tcp socket so OpenResty, Python, and AI harnesses do not need Tailcat or libzmq.
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Ack(delivery string) error
- func (c *Client) Close() error
- func (c *Client) Hello(name string) error
- func (c *Client) Nack(delivery string) error
- func (c *Client) Ping() error
- func (c *Client) Pub(topic, text string, body []byte) error
- func (c *Client) Put(name, text string, body []byte) error
- func (c *Client) Ready(service string) (wire.Frame, error)
- func (c *Client) Recv() (wire.Frame, error)
- func (c *Client) Rep(id, name, text string, body []byte) error
- func (c *Client) Request(name, text string, body []byte, timeout time.Duration, attempts int) (wire.Frame, error)
- func (c *Client) Reserve(name string, lease time.Duration) (wire.Frame, error)
- func (c *Client) Sub(prefix string) error
- func (c *Client) Take(name string) (wire.Frame, error)
- type Config
- type Node
Constants ¶
const MailboxPort uint16 = 7
MailboxPort is the TCP port on the Tailcat server that speaks zmqcat.
Variables ¶
var ( // ErrAbandoned is returned by Request after retries are exhausted. ErrAbandoned = errors.New("zmqcat: request abandoned") // ErrDesync means a read was interrupted part way through a frame, so the // remaining bytes of that frame are still queued. The session cannot be // resynchronized; redial instead. ErrDesync = errors.New("zmqcat: session desynchronized, redial required") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a single session on a hub (local unix/tcp or a spliced tunnel).
func (*Client) Request ¶
func (c *Client) Request(name, text string, body []byte, timeout time.Duration, attempts int) (wire.Frame, error)
Request is Lazy Pirate: req/rep with a correlation id, timeout, and retries. Duplicate delivery is possible; the same id is reused across attempts.
type Config ¶
type Config struct {
// MailboxPath enables durable at-least-once mailboxes on the serving node.
// Empty keeps the historical in-memory behavior.
MailboxPath string
// Heartbeat is the session liveness interval. Zero means 5s; negative disables.
Heartbeat time.Duration
// Trace logs each ZMQC frame (session, direction, op/id/name).
Trace bool
// Listen is the local sidecar address (unix:// or tcp://). Empty uses
// unix:///tmp/zmqcat-<uid>.sock.
Listen string
// Name is this node's hello identity.
Name string
// Logf logs diagnostics. Nil uses log.Printf. Set to a no-op to hush.
Logf func(string, ...any)
// Quiet suppresses Tailcat's own chatter.
Quiet bool
// AllowedClients, if non-empty, is a Tailcat nodekey allowlist.
AllowedClients []key.NodePublic
// DERPMapURL overrides Tailcat's default DERP map.
DERPMapURL string
// LocalOnly skips Tailcat (tests, same-host bus).
LocalOnly bool
// ForwardPorts are extra TCP ports on localhost to expose through the
// tunnel (a real libzmq bind, buzz, whatever). Serve dials
// 127.0.0.1:port; Join listens on 127.0.0.1:port and dials the server.
ForwardPorts []uint16
}
Config is Serve/Join options.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a running serve or join sidecar.
func Join ¶
Join connects to a Serve token, then exposes the same local sidecar. Each local connection is a Tailcat TCP session to MailboxPort.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
zmqcat
command
Command zmqcat is a ZMQ-style mailbox over Tailcat.
|
Command zmqcat is a ZMQ-style mailbox over Tailcat. |
|
internal
|
|
|
addr
Package addr parses zmqcat listen strings.
|
Package addr parses zmqcat listen strings. |
|
hub
Package hub serves the zmqcat wire protocol against a mailbox.Bus.
|
Package hub serves the zmqcat wire protocol against a mailbox.Bus. |
|
mailbox
Package mailbox is an in-process ZMQ-style bus: named queues (push/pull) and prefix topics (pub/sub).
|
Package mailbox is an in-process ZMQ-style bus: named queues (push/pull) and prefix topics (pub/sub). |
|
wire
Package wire is the zmqcat session protocol: magic + length + JSON.
|
Package wire is the zmqcat session protocol: magic + length + JSON. |