etcdpubsub

package
v0.0.0-...-d843dc6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTTLSeconds = 7 * 24 * 3600

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Client     *clientv3.Client
	Prefix     string
	TTLSeconds int
}

type EtcdPubSub

type EtcdPubSub struct {
	Config
}

func New

func New(config Config) (*EtcdPubSub, error)

func (*EtcdPubSub) Publish

func (ps *EtcdPubSub) Publish(ctx context.Context, topic string, msg Msg) error

func (*EtcdPubSub) Reset

func (ps *EtcdPubSub) Reset(ctx context.Context, topic string) error

func (*EtcdPubSub) Subscribe

func (ps *EtcdPubSub) Subscribe(ctx context.Context, topic string) (<-chan Msg, error)

Subscribe a topic from now

func (*EtcdPubSub) SubscribeFromRev

func (ps *EtcdPubSub) SubscribeFromRev(ctx context.Context, topic string, rev int64) (<-chan Msg, error)

func (*EtcdPubSub) SubscribeFromStart

func (ps *EtcdPubSub) SubscribeFromStart(ctx context.Context, topic string) (<-chan Msg, error)

Subscribe a topic from start

type Msg

type Msg struct {
	Name string
	Val  string
}

Jump to

Keyboard shortcuts

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