registry

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GRPC_KEY string = "grpc"
)
View Source
const (
	PeerScheme string = "peer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

func NewConfigRegistry

func NewConfigRegistry(ctx context.Context, config *gira.EtcdConfig) (*Registry, error)

func (*Registry) GetPeer

func (r *Registry) GetPeer(fullName string) *gira.Peer

根据app名查找节点 协程安全

func (*Registry) ListLocalUser

func (r *Registry) ListLocalUser() []string

func (*Registry) LockLocalUser

func (r *Registry) LockLocalUser(userId string) (*gira.Peer, error)

锁定玩家

func (*Registry) NewServiceName

func (r *Registry) NewServiceName(serviceName string, opt ...service_options.RegisterOption) string

func (*Registry) RangePeers

func (r *Registry) RangePeers(f func(k any, v any) bool)

func (*Registry) RegisterService

func (r *Registry) RegisterService(serviceName string, opt ...service_options.RegisterOption) (*gira.Peer, error)

注册服务

func (*Registry) SelfPeer

func (r *Registry) SelfPeer() *gira.Peer

func (*Registry) StartAsMember

func (r *Registry) StartAsMember() error

作为其中一个节点来启动 会将自己注册进去

func (*Registry) StartReslover

func (r *Registry) StartReslover() error

开启resolver

func (*Registry) Stop

func (r *Registry) Stop() error

关闭,释放资源

func (*Registry) UnlockLocalUser

func (r *Registry) UnlockLocalUser(userId string) (*gira.Peer, error)

解锁玩家

func (*Registry) UnregisterService

func (r *Registry) UnregisterService(serviceName string) (*gira.Peer, error)

反注册服务

func (*Registry) Watch

func (r *Registry) Watch(peerWatchHandlers []gira.PeerWatchHandler, localPlayerWatchHandlers []gira.LocalPlayerWatchHandler, serviceWatchHandlers []gira.ServiceWatchHandler) error

func (*Registry) WhereIsPeer

func (r *Registry) WhereIsPeer(appFullName string) (*gira.Peer, error)

查找节点

func (*Registry) WhereIsService

func (r *Registry) WhereIsService(serviceName string, opt ...service_options.WhereOption) ([]*gira.Peer, error)

查找服务

func (*Registry) WhereIsUser

func (r *Registry) WhereIsUser(userId string) (*gira.Peer, error)

查找玩家

Directories

Path Synopsis
service

Jump to

Keyboard shortcuts

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