Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionOptions ¶
type ConnectionOptions struct { RedisURL string MaxOpenConnection *int MaxIdleConnection *int IdleConnectionTimeout *config.DurationSeconds MaxConnectionLifetime *config.DurationSeconds }
func (*ConnectionOptions) ConnKey ¶
func (c *ConnectionOptions) ConnKey() string
type Handle ¶
type Handle struct { ConnectionOptions ConnectionOptions // contains filtered or unexported fields }
type Hub ¶
type Hub struct { Pool *Pool Logger *log.Logger SubscriberID *SubscriberID PubSub map[string]*PubSub // Mailbox handles 3 messages. // This mailbox is never closed. Mailbox chan interface{} }
Hub aims to multiplex multiple subscription to Redis PubSub channel over a single connection.
func (*Hub) Subscribe ¶
func (h *Hub) Subscribe( ConnectionOptions *ConnectionOptions, channelName string, ) Subscription
type HubMessagePubSubCancel ¶
type HubMessagePubSubDead ¶
type HubMessagePubSubDead struct {
ConnKey string
}
type HubMessageSubscribe ¶
type HubMessageSubscribe struct { ConnectionOptions *ConnectionOptions ChannelName string Result chan Subscription }
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) Client ¶
func (p *Pool) Client(connectionOptions *ConnectionOptions) *redis.Client
type PubSub ¶
type PubSub struct { ConnKey string SupervisorMailbox chan interface{} Logger *log.Logger PubSub *redis.PubSub Subscriber map[string][]Subscriber // Mailbox handles 3 messages. // 1. When the mailbox is closed, that means the actor should die. // 2. PubSubMessageJoin // 3. PubSubMessageLeave Mailbox chan interface{} }
PubSub is an actor wrapping redis.PubSub
type PubSubMessageJoin ¶
type PubSubMessageJoin Subscriber
PubSubMessageJoin is essentially Subscriber.
type PubSubMessageLeave ¶
PubSubMessageLeave is basically Subscriber without MessageChannel.
type Subscriber ¶
type Subscriber struct { ChannelName string SubscriberID int64 // The drop pattern // See https://www.ardanlabs.com/blog/2017/10/the-behavior-of-channels.html MessageChannel chan *redis.Message }
type SubscriberID ¶
type SubscriberID struct {
Counter int64
}
func (*SubscriberID) Next ¶
func (i *SubscriberID) Next() int64
type Subscription ¶
type Subscription struct { MessageChannel chan *redis.Message Cancel func() }
Click to show internal directories.
Click to hide internal directories.