Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ConsoleOpts = &Opts{ Timeout: time.Minute * 120, Record: true, }
var DefaultOpts = &Opts{ Timeout: 0, Record: false, }
Functions ¶
func NewContext ¶
NewContext returns a Context whose Value method returns the PubSub module.
func Unregister ¶
Unregister performs a thread safe operation to delete the Channel with the given key.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
func Lookup ¶
Lookup performs a thread safe operation to return a pointer to an existing Channel object with the given key. If the Channel does not exist a nil value is returned.
func NewChannel ¶
func Register ¶
Register performs a thread safe operation to return a pointer to a Channel object for the given key. The Channel is created if it does not yet exist.
func RegisterOpts ¶
Register performs a thread safe operation to return a pointer to a Channel object for the given key. The Channel is created if it does not yet exist using custom options.
func (*Channel) Subscribe ¶
func (c *Channel) Subscribe() *Subscription
type Opts ¶
type Opts struct { // Timeout sets the expiration date for the channel, // at which time it will be closed and transmission will // stop. A zero value for means the channel will not timeout. Timeout time.Duration // Record indicates the channel should record the channel // activity and playback the full history to subscribers. Record bool }
type PubSub ¶
func FromContext ¶
FromContext returns the pool assigned to the context.
func NewPubSub ¶
func NewPubSub() *PubSub
NewPubSub creates a new instance of the PubSub type and returns a pointer.
func (*PubSub) Lookup ¶
Lookup performs a thread safe operation to return a pointer to an existing Channel object with the given key. If the Channel does not exist a nil value is returned.
func (*PubSub) Register ¶
Register performs a thread safe operation to return a pointer to a Channel object for the given key. The Channel is created if it does not yet exist.
func (*PubSub) RegisterOpts ¶
Register performs a thread safe operation to return a pointer to a Channel object for the given key. The Channel is created if it does not yet exist using custom options.
func (*PubSub) Unregister ¶
func (b *PubSub) Unregister(key interface{})
Unregister performs a thread safe operation to delete the Channel with the given key.
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
func NewSubscription ¶
func NewSubscription(channel *Channel) *Subscription
func (*Subscription) Close ¶
func (s *Subscription) Close()
func (*Subscription) CloseNotify ¶
func (s *Subscription) CloseNotify() <-chan bool
func (*Subscription) Read ¶
func (s *Subscription) Read() <-chan interface{}