watcher

package
v2.0.7-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeEvent

type ChangeEvent struct {
	Old any
	New any
}

type Event

type Event struct {
	// Event *clientv3.Event
	Data interface{}
}

Event watcher event

type EventType

type EventType byte
const EventTypeDelete EventType = 1
const EventTypeUpdate EventType = 0

func (EventType) IsDelete

func (t EventType) IsDelete() bool

func (EventType) IsUpdate

func (t EventType) IsUpdate() bool

type General

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

General a base watcher this will be use for most watchers

func New

func New(opts ...Option) (w *General, err error)

New returns a new General watcher with handler

func (*General) Close

func (w *General) Close() error

func (*General) WatchEtcd

func (w *General) WatchEtcd(ctx context.Context) (ch chan *WatcherEvent, err error)

WatchEtcd start watch etcd changes

func (*General) WatchEtcdList

func (w *General) WatchEtcdList(ctx context.Context) (ch chan *WatcherEvent, err error)

WatchEtcdList start watch etcd changes for list

func (*General) WatchNode

func (w *General) WatchNode(ctx context.Context) (chan *WatcherEvent, error)

type Option

type Option func(*Options)

func WithKey

func WithKey(k string) Option

type Options

type Options struct {
	Key string
}

func NewOptions

func NewOptions(opt ...Option) *Options

type RedisWatcher

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

func (*RedisWatcher) WatchNode

func (watcher *RedisWatcher) WatchNode(ctx context.Context) chan node.Node

func (*RedisWatcher) WatchPipelinBind

func (watcher *RedisWatcher) WatchPipelinBind(ctx context.Context) chan model.PipelineBind

type Watcher

type Watcher interface {
	// Watch(ctx context.Context, key string) (chan model.Model, error)
	// WtachList(ctx context.Context, key string) (chan model.Model, error)
	WatchPipelinBind(ctx context.Context) chan model.PipelineBind
	WatchNode(ctx context.Context) chan node.Node
}

Watcher a wrapper for etcd watcher

func Default

func Default() Watcher

type WatcherEvent

type WatcherEvent struct {
	EventType EventType
	Data      model.Model
}

Jump to

Keyboard shortcuts

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