Documentation
¶
Index ¶
- type Channel
- type HandlerFunc
- type PubSub
- func (ps *PubSub) Count(bucket, channel string) int
- func (ps *PubSub) IDs(bucket, channel string) []int64
- func (ps *PubSub) Publish(bucket, channel string, payload []byte) (int, error)
- func (ps *PubSub) Subscribe(bucket, channel string, fn func([]byte)) (int64, func())
- func (ps *PubSub) SubscribeSimple(bucket, channel string, fn func([]byte)) func()
- func (ps *PubSub) UnsubscribeAll(bucket, channel string)
- type ReqResp
- func (r *ReqResp) Call(name string, payload []byte) ([]byte, error)
- func (r *ReqResp) CallDirect(name string, payload []byte) ([]byte, error)
- func (r *ReqResp) Handlers() []string
- func (r *ReqResp) Has(name string) bool
- func (r *ReqResp) Register(name string, fn HandlerFunc)
- func (r *ReqResp) Unregister(name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel holds subscribers for a specific bucket+channel
type HandlerFunc ¶
HandlerFunc is the signature every REQ/RESP handler must satisfy.
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub is a high-performance publish-subscribe system
func (*PubSub) Subscribe ¶
Subscribe adds a subscriber and returns its ID and an unsubscribe function
func (*PubSub) SubscribeSimple ¶
SubscribeSimple adds a subscriber and returns only the unsubscribe function
func (*PubSub) UnsubscribeAll ¶
UnsubscribeAll removes all subscribers from a channel
type ReqResp ¶
type ReqResp struct {
// contains filtered or unexported fields
}
ReqResp manages named request/response handlers using a sharded map.
func NewReqResp ¶
NewReqResp creates a new ReqResp instance.
func (*ReqResp) Call ¶
Call invokes the named handler with timeout protection. Optimized to use sync.Once for the goroutine to reduce allocations.
func (*ReqResp) CallDirect ¶
CallDirect invokes the handler in the current goroutine.
func (*ReqResp) Register ¶
func (r *ReqResp) Register(name string, fn HandlerFunc)
Register binds name → handler.
func (*ReqResp) Unregister ¶
Unregister removes the named handler.