informer

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: LGPL-2.1 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Informer

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

func NewInformer

func NewInformer(consuls []model.ConsulInfo, serviceNames []string) *Informer

func (*Informer) Stop

func (informer *Informer) Stop()

func (*Informer) Watch

func (informer *Informer) Watch() chan *StateChange

type PlanParam

type PlanParam struct {
	Type        string   `structs:"type"`
	Service     string   `structs:"service"`
	PassingOnly bool     `structs:"passingonly"`
	DC          string   `structs:"datacenter,omitempty"`
	Token       string   `structs:"token,omitempty"`
	Tag         []string `structs:"tag,omitempty"`
	Stale       bool     `structs:"stale,omitempty"`
}

type ServiceWatcher

type ServiceWatcher struct {
	ServiceName  string
	DC           string
	Token        string
	Plan         *watch.Plan // 每个service的单独监控
	ServiceState *State      // 最新状态
	ConsulAddr   string
}

func NewServiceWatcher

func NewServiceWatcher(service string, c *model.ConsulInfo, ch chan<- *StateChange) (*ServiceWatcher, error)

func (*ServiceWatcher) Run

func (w *ServiceWatcher) Run() error

func (*ServiceWatcher) Stop

func (w *ServiceWatcher) Stop()

type State

type State struct {
	ServiceEntrys []*consulapi.ServiceEntry
	T             time.Time
	Index         uint64
}

type StateChange

type StateChange struct {
	NewState State
	DC       string
	Service  string
	// 上次Index值
	LastIndex uint64
}

Jump to

Keyboard shortcuts

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