watcher

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAfterInitialLoad

func WithAfterInitialLoad[T any](callback func()) func(*Watcher[T])

func WithBeforeUpdate

func WithBeforeUpdate[T any](callback func(entry T, direction mvccpb.Event_EventType)) func(*Watcher[T])

func WithKeyFunc

func WithKeyFunc[T any](kf func(key string) string) func(*Watcher[T])

func WithPrefix

func WithPrefix[T any]() func(*Watcher[T])

Types

type Watcher

type Watcher[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](
	constructor func(*mvccpb.KeyValue) (T, error),
	client *storage.Client,
	prefix *storage.Key,
	opts ...func(w *Watcher[T]),
) *Watcher[T]

func (*Watcher[T]) Get

func (w *Watcher[T]) Get(key string) T

func (*Watcher[T]) GetOK

func (w *Watcher[T]) GetOK(key string) (T, bool)

func (*Watcher[T]) GetPrefix

func (w *Watcher[T]) GetPrefix(parts ...string) (T, bool)

func (*Watcher[T]) Iter

func (w *Watcher[T]) Iter() iter.Seq2[string, T]

func (*Watcher[T]) IterRelativeKey

func (w *Watcher[T]) IterRelativeKey() iter.Seq2[string, T]

func (*Watcher[T]) Prefix

func (w *Watcher[T]) Prefix() *storage.Key

func (*Watcher[T]) Start

func (w *Watcher[T]) Start(ctx context.Context)

func (*Watcher[T]) Stop

func (w *Watcher[T]) Stop()

Jump to

Keyboard shortcuts

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