gate

package
v0.0.0-...-457ba4f Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

* User: cr-mao Date: 2023/8/19 10:06 Email: crmao@qq.com Desc: constant.go

* User: cr-mao Date: 2023/8/19 10:38 Email: crmao@qq.com Desc: grpc_server.go

* User: cr-mao Date: 2023/8/18 15:21 Email: crmao@qq.com Desc: node_client.go

* User: cr-mao Date: 2023/8/19 09:49 Email: crmao@qq.com Desc: transport.go

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidArgument = errors.New("ErrInvalidArgument")
View Source
var ErrNotFoundUserSource = errors.New("not found user source")

Functions

This section is empty.

Types

type Gate

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

func NewGate

func NewGate(opts ...Option) *Gate

func (*Gate) Destroy

func (g *Gate) Destroy()

Destroy 销毁组件

func (*Gate) Init

func (g *Gate) Init()

Init 初始化

func (*Gate) Name

func (g *Gate) Name() string

Name 组件名称

func (*Gate) Start

func (g *Gate) Start()

Start 启动组件

type NodeGrpcClient

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

func NewNodeClient

func NewNodeClient(cc *grpc.ClientConn) *NodeGrpcClient

func (*NodeGrpcClient) Deliver

func (c *NodeGrpcClient) Deliver(ctx context.Context, args *cluster.DeliverArgs) (miss bool, err error)

Deliver 投递消息

func (*NodeGrpcClient) Trigger

func (c *NodeGrpcClient) Trigger(ctx context.Context, args *cluster.TriggerArgs) (miss bool, err error)

Trigger 触发事件

type Option

type Option func(o *options)

func WithAuthTimeOut

func WithAuthTimeOut(t int64) Option

func WithContext

func WithContext(ctx context.Context) Option

WithContext 设置上下文

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 WithServer

func WithServer(server network.Server) Option

WithServer 设置服务器

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout 设置RPC调用超时时间

func WithTransport

func WithTransport(t *Transport) Option

消息传输, gate server,node client

func WithWeight

func WithWeight(weight int) Option

type ServerOptions

type ServerOptions struct {
	Addr       string
	ServerOpts []mygrpc.ServerOption
}

type TransOptionFunc

type TransOptionFunc func(o *transOptions)

func WithClientDialOptions

func WithClientDialOptions(opts ...grpc.DialOption) TransOptionFunc

WithClientDialOptions 设置客户端拨号选项

func WithClientPoolSize

func WithClientPoolSize(size int) TransOptionFunc

WithClientPoolSize 设置客户端连接池大小

func WithServerListenAddr

func WithServerListenAddr(addr string) TransOptionFunc

WithServerListenAddr 设置服务器监听地址

func WithServerOptions

func WithServerOptions(opts ...mygrpc.ServerOption) TransOptionFunc

WithServerOptions 设置服务器选项

type Transport

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

func NewTransport

func NewTransport(opts ...TransOptionFunc) *Transport

func (*Transport) NewGateServer

func (t *Transport) NewGateServer(provider *provider) (*mygrpc.Server, error)

func (*Transport) NewNodeClient

func (t *Transport) NewNodeClient(ep *endpoint.Endpoint) (*NodeGrpcClient, error)

Jump to

Keyboard shortcuts

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