locate

package
v0.0.0-...-c1e5b24 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// 用户ID
	UID int64 `json:"uid"`
	// 事件类型
	Type EventType `json:"type"`
	// 实例ID
	InsID string `json:"ins_id"`
	// 实例类型
	InsKind cluster.Kind `json:"ins_kind"`
	// 实例名称
	InsName string `json:"ins_name"`
}

type EventType

type EventType int
const (
	BindGate   EventType = iota + 1 // 绑定网关
	BindNode                        // 绑定节点
	UnbindGate                      // 解绑网关
	UnbindNode                      // 解绑节点
)

type Locator

type Locator interface {
	// Watch 监听用户定位变化
	Watch(ctx context.Context, kinds ...cluster.Kind) (Watcher, error)
	// BindGate 绑定网关
	BindGate(ctx context.Context, uid int64, gid string) error
	// BindNode 绑定节点
	BindNode(ctx context.Context, uid int64, name, nid string) error
	// UnbindGate 解绑网关
	UnbindGate(ctx context.Context, uid int64, gid string) error
	// UnbindNode 解绑节点
	UnbindNode(ctx context.Context, uid int64, name string, nid string) error
	// LocateGate 定位用户所在网关
	LocateGate(ctx context.Context, uid int64) (string, error)
	// LocateNode 定位用户所在节点
	LocateNode(ctx context.Context, uid int64, name string) (string, error)
}

type Watcher

type Watcher interface {
	// Next 返回用户位置列表
	Next() ([]*Event, error)
	// Stop 停止监听
	Stop() error
}

Directories

Path Synopsis
redis module

Jump to

Keyboard shortcuts

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