pubsub

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commands

func Commands() []internal.Command

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(ctx context.Context, 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) Subscribe

func (ch *Channel) Subscribe(sub any, action string, chanIdx int)

func (*Channel) Unsubscribe

func (ch *Channel) Unsubscribe(sub any) bool

type EmbeddedSub

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

func NewEmbeddedSub

func NewEmbeddedSub() *EmbeddedSub

func (*EmbeddedSub) Read

func (sub *EmbeddedSub) Read(p []byte) (int, error)

func (*EmbeddedSub) Write

func (sub *EmbeddedSub) Write(p []byte) (int, error)

type PubSub

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

func NewPubSub

func NewPubSub(ctx context.Context) *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(message string, channelName string)

func (*PubSub) Subscribe

func (ps *PubSub) Subscribe(sub any, channels []string, withPattern bool)

func (*PubSub) Unsubscribe

func (ps *PubSub) Unsubscribe(sub any, channels []string, withPattern bool) []byte

Jump to

Keyboard shortcuts

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