etcdservice

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EtcdService

type EtcdService struct {
	*zservice.ZService
	EtcdClient *clientv3.Client
}

func NewEtcdService

func NewEtcdService(c EtcdServiceOption) *EtcdService

func (*EtcdService) SendEvent

func (es *EtcdService) SendEvent(ctx *zservice.Context, key string, val []byte) *zservice.Error

发送事件

func (*EtcdService) WatchEvent

func (es *EtcdService) WatchEvent(key string, cb func(ctx *zservice.Context, val []byte)) (cancelFunc context.CancelFunc)

监听事件,支持取消功能

type EtcdServiceOption added in v0.2.0

type EtcdServiceOption struct {
	Name    string             // 显示在日志中的名称
	Addr    string             // ETCD 服务地址
	OnStart func(*EtcdService) // 启动的回调
}

type EventBody

type EventBody struct {
	S2S string `json:"s2s"` // S2S 数据
	Val []byte `json:"val"` // 内存
}

Jump to

Keyboard shortcuts

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