master

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidGID         = link.ErrInvalidGID
	ErrInvalidNID         = link.ErrInvalidNID
	ErrInvalidMessage     = link.ErrInvalidMessage
	ErrInvalidArgument    = link.ErrInvalidArgument
	ErrInvalidSessionKind = link.ErrInvalidSessionKind
	ErrNotFoundUserSource = link.ErrNotFoundUserSource
	ErrReceiveTargetEmpty = link.ErrReceiveTargetEmpty
)

Functions

This section is empty.

Types

type Master

type Master struct {
	component.Base
	// contains filtered or unexported fields
}

func NewMaster

func NewMaster(opts ...Option) *Master

func (*Master) Destroy

func (m *Master) Destroy()

Destroy 销毁组件

func (*Master) Init

func (m *Master) Init()

Init 初始化组件

func (*Master) Name

func (m *Master) Name() string

Name 组件名称

func (*Master) Proxy

func (m *Master) Proxy() *Proxy

Proxy 获取管理服代理

func (*Master) Start

func (m *Master) Start()

Start 启动组件

type Message

type Message = link.Message

type Option

type Option func(o *options)

func WithCatServer added in v0.0.23

func WithCatServer(catServer *cat.Server) Option

WithCatServer 设置cat server

func WithCodec

func WithCodec(codec encoding.Codec) Option

WithCodec 设置编解码器

func WithContext

func WithContext(ctx context.Context) Option

WithContext 设置上下文

func WithDecryptor

func WithDecryptor(decryptor crypto.Decryptor) Option

WithDecryptor 设置消息解密器

func WithEncryptor

func WithEncryptor(encryptor crypto.Encryptor) Option

WithEncryptor 设置消息加密器

func WithID

func WithID(id string) Option

WithID 设置实例ID

func WithLocator

func WithLocator(locator locate.Locator) Option

WithLocator 设置定位器

func WithName

func WithName(name string) Option

WithName 设置实例名称

func WithRegistry

func WithRegistry(r registry.Registry) Option

WithRegistry 设置服务注册器

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout 设置RPC调用超时时间

func WithTransporter

func WithTransporter(transporter transport.Transporter) Option

WithTransporter 设置消息传输器

type Proxy

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

func (*Proxy) BlockConn added in v0.0.23

func (p *Proxy) BlockConn(ctx context.Context, onid string, nnid string, target uint64)

BlockConn

func (*Proxy) Broadcast

func (p *Proxy) Broadcast(ctx context.Context, kind session.Kind, message *Message) (int64, error)

Broadcast 推送广播消息

func (*Proxy) BroadcastDeliver added in v0.0.23

func (p *Proxy) BroadcastDeliver(ctx context.Context, kind link.DeliverKind, message *Message) error

BroadcastDeliver 推送广播消息到node节点

func (*Proxy) Deliver

func (p *Proxy) Deliver(ctx context.Context, uid int64, message *Message) error

Deliver 投递消息给节点处理

func (*Proxy) DeliverN added in v0.0.23

func (p *Proxy) DeliverN(ctx context.Context, nid string, message *Message) error

DeliverN 通过nodeId投递消息给节点处理

func (*Proxy) Disconnect

func (p *Proxy) Disconnect(ctx context.Context, uid int64, isForce bool) error

Disconnect 断开连接

func (*Proxy) FetchCenterList added in v0.0.23

func (p *Proxy) FetchCenterList(ctx context.Context, states ...cluster.State) ([]*registry.ServiceInstance, error)

FetchCenterList 拉取Center节点列表

func (*Proxy) FetchGameList added in v0.0.23

func (p *Proxy) FetchGameList(ctx context.Context, states ...cluster.State) ([]*registry.ServiceInstance, error)

FetchGameList 拉取游戏节点列表

func (*Proxy) FetchGateList

func (p *Proxy) FetchGateList(ctx context.Context, states ...cluster.State) ([]*registry.ServiceInstance, error)

FetchGateList 拉取网关列表

func (*Proxy) FetchNodeList

func (p *Proxy) FetchNodeList(ctx context.Context, states ...cluster.State) ([]*registry.ServiceInstance, error)

FetchNodeList 拉取节点列表

func (*Proxy) GetIP

func (p *Proxy) GetIP(ctx context.Context, uid int64) (string, error)

GetIP 获取客户端IP

func (*Proxy) GetMasterID

func (p *Proxy) GetMasterID() string

GetMasterID 获取当前管理节点ID

func (*Proxy) GetMasterName

func (p *Proxy) GetMasterName() string

GetMasterName 获取当前管理节点名称

func (*Proxy) LocateGate

func (p *Proxy) LocateGate(ctx context.Context, uid int64) (string, error)

LocateGate 定位用户所在网关

func (*Proxy) LocateNode

func (p *Proxy) LocateNode(ctx context.Context, uid int64) (string, error)

LocateNode 定位用户所在节点

func (*Proxy) Multicast

func (p *Proxy) Multicast(ctx context.Context, uids []int64, message *Message) (int64, error)

Multicast 推送组播消息

func (*Proxy) MulticastDeliver added in v0.0.23

func (p *Proxy) MulticastDeliver(ctx context.Context, kind link.DeliverKind, targets []string, message *Message) error

MulticastDeliver 推送广播消息到node节点

func (*Proxy) Push

func (p *Proxy) Push(ctx context.Context, uid int64, message *Message) error

Push 推送消息

func (*Proxy) StatWithInsId added in v0.0.56

func (p *Proxy) StatWithInsId(ctx context.Context, insId string) (int64, error)

Jump to

Keyboard shortcuts

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