cluster

package
v0.0.0-...-2a93a25 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTopicTooLong = errors.New("topic name is too long, maximum length is 255")
	ErrReadTooShort = errors.New("read is too short")
)

errors about topic name.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	ID             uuid.UUID
	RedisOptions   config.Redis
	MetricRegistry prometheus.Registerer
	Keyspace       string
	Logger         zerolog.Logger
	// contains filtered or unexported fields
}

Cluster implement types.Cluster using Redis pub/sub.

func (*Cluster) Close

func (c *Cluster) Close() error

func (*Cluster) Publish

func (c *Cluster) Publish(ctx context.Context, topic string, message []byte) error

Publish send a message to given topic. Publish must not be called before Start() (or after Stop()).

func (*Cluster) Size

func (c *Cluster) Size() int

func (*Cluster) Start

func (c *Cluster) Start(ctx context.Context) error

func (*Cluster) Stop

func (c *Cluster) Stop() error

func (*Cluster) Subscribe

func (c *Cluster) Subscribe(topic string, callback func([]byte))

Subscribe to message on given topic. The callback should be quick or it may cause message lost.

Jump to

Keyboard shortcuts

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