Documentation
¶
Overview ¶
Package gateway turns permitted Discord messages into events on the bus.
It is the whole of what spec 0019 D2 asks the gateway to be: read, filter, publish, and do no work that can block. The filtering is the pump's; this is the publish.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus interface {
PublishValue(
ctx context.Context, subject, eventType string, v any, opts ...messaging.PublishOption,
) error
}
Bus is the narrow slice of the message bus this package needs.
An interface rather than *messaging.Bus so the publish can be tested without standing one up, and so this package declares its dependency rather than inheriting the whole surface.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher is an ingest.Handler that publishes what the pump admits.
func (*Publisher) Failed ¶
Failed counts messages and votes that did not, which the bus never sees and so never counts.
func (*Publisher) Handle ¶
Handle publishes one message. It satisfies ingest.Handler.
That signature returns nothing, so a failed publish cannot propagate: it is a drop before the bus, where none of the bus's own accounting applies, and it is counted here or it is counted nowhere (0019 D2).
func (*Publisher) HandleReaction ¶ added in v0.9.0
HandleReaction publishes a feedback vote, and drops anything else before the bus (spec 0027 D1). A failure is counted, as Handle's is.