Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Distributor

type Distributor interface {
	SetSnapshot(name string, snapshot sn.Snapshot)

	ClearSnapshot(name string)
}

Distributor interface allows processor to distribute snapshots of configuration.

type InMemoryDistributor

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

InMemoryDistributor is an in-memory distributor implementation.

func NewInMemoryDistributor

func NewInMemoryDistributor() *InMemoryDistributor

NewInMemoryDistributor returns a new instance of InMemoryDistributor

func (*InMemoryDistributor) ClearSnapshot

func (d *InMemoryDistributor) ClearSnapshot(name string)

ClearSnapshot is an implementation of Distributor.ClearSnapshot

func (*InMemoryDistributor) GetSnapshot

func (d *InMemoryDistributor) GetSnapshot(name string) sn.Snapshot

GetSnapshot get the snapshot of the specified name

func (*InMemoryDistributor) ListenChanges

func (d *InMemoryDistributor) ListenChanges(cancel chan bool, fn ListenerFn)

ListenChanges registered listener and start listening snapshot changes in the distributor

func (*InMemoryDistributor) NumSnapshots

func (d *InMemoryDistributor) NumSnapshots() int

NumSnapshots returns the current number of snapshots.

func (*InMemoryDistributor) SetSnapshot

func (d *InMemoryDistributor) SetSnapshot(name string, snapshot sn.Snapshot)

SetSnapshot is an implementation of Distributor.SetSnapshot

type ListenerFn

type ListenerFn func(s sn.Snapshot)

ListenerFn is used by listeners for defining listen action

type Strategy

type Strategy struct {

	// Publish channel is used to trigger the publication of snapshots.
	Publish chan struct{}
	// contains filtered or unexported fields
}

Strategy is a heuristic model for deciding when to publish snapshots. It tries to detect quiesce points for events with a total bounded wait time.

func NewStrategy

func NewStrategy(
	maxWaitDuration time.Duration,
	quiesceDuration time.Duration,
	timerFrequency time.Duration) *Strategy

NewStrategy creates a new strategy with the given values.

func NewStrategyWithDefaults

func NewStrategyWithDefaults() *Strategy

NewStrategyWithDefaults creates a new strategy with default values.

func (*Strategy) OnChange

func (s *Strategy) OnChange()

func (*Strategy) Reset

func (s *Strategy) Reset()