pubsub

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithName

func WithName(name string) func(channel *Channel)

WithName option sets the channels name.

func WithPattern

func WithPattern(pattern string) func(channel *Channel)

WithPattern option sets the compiled glob pattern for the channel if it's a pattern channel.

Types

type Channel

type Channel struct {
	// contains filtered or unexported fields
}

func NewChannel

func NewChannel(options ...func(channel *Channel)) *Channel

func (*Channel) IsActive

func (ch *Channel) IsActive() bool

func (*Channel) Name

func (ch *Channel) Name() string

func (*Channel) NumSubs

func (ch *Channel) NumSubs() int

func (*Channel) Pattern

func (ch *Channel) Pattern() glob.Glob

func (*Channel) Publish

func (ch *Channel) Publish(message string)

func (*Channel) Start

func (ch *Channel) Start()

func (*Channel) Subscribe

func (ch *Channel) Subscribe(conn *net.Conn) bool

func (*Channel) Subscribers

func (ch *Channel) Subscribers() map[*net.Conn]*resp.Conn

func (*Channel) Unsubscribe

func (ch *Channel) Unsubscribe(conn *net.Conn) bool

type PubSub

type PubSub struct {
	// contains filtered or unexported fields
}

func NewPubSub

func NewPubSub() *PubSub

func (*PubSub) Channels

func (ps *PubSub) Channels(pattern string) []byte

func (*PubSub) GetAllChannels

func (ps *PubSub) GetAllChannels() []*Channel

func (*PubSub) NumPat

func (ps *PubSub) NumPat() int

func (*PubSub) NumSub

func (ps *PubSub) NumSub(channels []string) []byte

func (*PubSub) Publish

func (ps *PubSub) Publish(_ context.Context, message string, channelName string)

func (*PubSub) Subscribe

func (ps *PubSub) Subscribe(_ context.Context, conn *net.Conn, channels []string, withPattern bool)

func (*PubSub) Unsubscribe

func (ps *PubSub) Unsubscribe(_ context.Context, conn *net.Conn, channels []string, withPattern bool) []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL