etcd

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerDiscovery

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

ControllerDiscovery Controller 发现服务

func NewControllerDiscovery

func NewControllerDiscovery(client *clientv3.Client, watchPrefix string) *ControllerDiscovery

NewControllerDiscovery 创建 Controller 发现服务

func (*ControllerDiscovery) GetController

func (cd *ControllerDiscovery) GetController(area, controllerID string) (*models.Controller, error)

GetController 获取指定区域的 Controller

func (*ControllerDiscovery) GetControllerByArea

func (cd *ControllerDiscovery) GetControllerByArea(area string) (*models.Controller, error)

GetControllerByArea 获取指定区域的 Controller(返回第一个)

func (*ControllerDiscovery) ListControllers

func (cd *ControllerDiscovery) ListControllers() []*models.Controller

ListControllers 列出所有 Controller

func (*ControllerDiscovery) ListControllersByArea

func (cd *ControllerDiscovery) ListControllersByArea(area string) []*models.Controller

ListControllersByArea 列出指定区域的所有 Controller

func (*ControllerDiscovery) PeriodicSync

func (cd *ControllerDiscovery) PeriodicSync()

PeriodicSync 定期同步 Controller 列表

func (*ControllerDiscovery) SetOnControllerDelete

func (cd *ControllerDiscovery) SetOnControllerDelete(fn func(string))

SetOnControllerDelete 设置 Controller 删除回调

func (*ControllerDiscovery) SetOnControllerUpdate

func (cd *ControllerDiscovery) SetOnControllerUpdate(fn func(*models.Controller))

SetOnControllerUpdate 设置 Controller 更新回调

func (*ControllerDiscovery) Start

func (cd *ControllerDiscovery) Start() error

Start 启动 Controller 发现服务

func (*ControllerDiscovery) Stop

func (cd *ControllerDiscovery) Stop()

Stop 停止 Controller 发现服务

func (*ControllerDiscovery) SyncControllers

func (cd *ControllerDiscovery) SyncControllers(ctx context.Context) error

SyncControllers 从 etcd 同步所有 Controller

func (*ControllerDiscovery) WatchControllers

func (cd *ControllerDiscovery) WatchControllers()

WatchControllers 监听 etcd 中的 Controller 变化

type ControllerInfo

type ControllerInfo struct {
	ID        string    `json:"id"`
	Address   string    `json:"address"`
	Area      string    `json:"area"`
	StartTime time.Time `json:"start_time"`
	Version   string    `json:"version"`
}

ControllerInfo Controller 在 etcd 中的注册信息结构

Jump to

Keyboard shortcuts

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