rpc

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const LOCAL_NAME = "local"

Variables

This section is empty.

Functions

func CallAllClient

func CallAllClient[T MergeResult](r *RpcManager, ctx context.Context, method string, req any, res T) error

func GetSelfAddress

func GetSelfAddress(info []*config.Address) *config.Address

Types

type AddressManager

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

func NewAddressManager

func NewAddressManager(c *config.Config) (*AddressManager, error)

func (*AddressManager) GeneratorConnectionAddress

func (a *AddressManager) GeneratorConnectionAddress() *event.Address

func (*AddressManager) GeneratorLocalID

func (a *AddressManager) GeneratorLocalID() string

func (*AddressManager) GeneratorRoomAddress

func (a *AddressManager) GeneratorRoomAddress() *event.Address

func (*AddressManager) GetMachineIpInfo

func (a *AddressManager) GetMachineIpInfo() map[string]*config.Address

func (*AddressManager) GetSelfAddress

func (a *AddressManager) GetSelfAddress() *config.Address

func (*AddressManager) GetSelfMachineID

func (a *AddressManager) GetSelfMachineID() string

func (*AddressManager) IsSelfMachineAddress

func (a *AddressManager) IsSelfMachineAddress(address *event.Address) bool

type MergeResult

type MergeResult interface {
	Merge(result MergeResult) error
	New() MergeResult
}

type Result

type Result struct {
	Result interface{} `json:"result"`
	Error  string      `json:"error"`
	Id     int64       `json:"id"`
}

type RpcClient

type RpcClient struct {
	state.StatusMachine
	// contains filtered or unexported fields
}

func NewRpcClient

func NewRpcClient(address string) *RpcClient

func (*RpcClient) Call

func (r *RpcClient) Call(ctx context.Context, serviceMethod string, args interface{}, reply interface{}) error

func (*RpcClient) GetClient

func (r *RpcClient) GetClient() (*rpc.Client, error)

type RpcManager

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

func NewRpcManager

func NewRpcManager(addressManager *AddressManager) *RpcManager

func (*RpcManager) GetRpcByAddress

func (r *RpcManager) GetRpcByAddress(address *event.Address) *RpcClient

func (*RpcManager) GetRpcList

func (r *RpcManager) GetRpcList() []*RpcClient

func (*RpcManager) Regist

func (r *RpcManager) Regist(name string, api interface{}) error

func (*RpcManager) Run

func (r *RpcManager) Run()

Jump to

Keyboard shortcuts

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