etcdservice

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 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 *EtcdServiceConfig) *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 EtcdServiceConfig

type EtcdServiceConfig struct {
	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