rpc

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: GPL-3.0 Imports: 17 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallClient

func CallClient(c context.Context, clientID string, event pb.Event, msg proto.Message) (*pb.ClientMessage, error)

func CallClientWrapper added in v0.1.0

func CallClientWrapper[R common.RespType](c context.Context, clientID string, event pb.Event, req proto.Message, resp *R) error

func GetClientCert

func GetClientCert(clientID, clientSecret string, clientType pb.ClientType) []byte

func InitRPCClients

func InitRPCClients()

func MasterCli

func MasterCli(c context.Context) (pb.MasterClient, error)

func MustInitClientsManager

func MustInitClientsManager()

func Recv

func Recv(clientID string) chan bool

Types

type ClientsManager

type ClientsManager interface {
	Get(cliID string) *Connector
	Set(cliID, clientType string, sender pb.Master_ServerSendServer)
	Remove(cliID string)
	ClientAddr(cliID string) string
	ConnectTime(cliID string) (time.Time, bool)
}

func GetClientsManager

func GetClientsManager() ClientsManager

type ClientsManagerImpl

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

func NewClientsManager

func NewClientsManager() *ClientsManagerImpl

func (*ClientsManagerImpl) ClientAddr added in v0.0.32

func (c *ClientsManagerImpl) ClientAddr(cliID string) string

func (*ClientsManagerImpl) ConnectTime added in v0.0.32

func (c *ClientsManagerImpl) ConnectTime(cliID string) (time.Time, bool)

func (*ClientsManagerImpl) Get

func (c *ClientsManagerImpl) Get(cliID string) *Connector

Get implements ClientsManager.

func (*ClientsManagerImpl) Remove

func (c *ClientsManagerImpl) Remove(cliID string)

func (*ClientsManagerImpl) Set

func (c *ClientsManagerImpl) Set(cliID, clientType string, sender pb.Master_ServerSendServer)

Set implements ClientsManager.

type Connector

type Connector struct {
	CliID   string
	Conn    pb.Master_ServerSendServer
	CliType string
}

Jump to

Keyboard shortcuts

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