begonia

package module
v0.0.0-...-6ff0b38 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

begonia

begonia

begonia

begonia

begonia

begonia

begonia

begonia

begonia

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must

func Must(fun func(), ch chan bool) (res bool)

func Result

func Result(res interface{}, err error) rResult

Types

type Callback

type Callback = func(interface{}, error)

type CallbackChan

type CallbackChan = chan CallbackEntity

type CallbackEntity

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

type Client

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

func Default

func Default(addr string) *Client

New 创建客户端并监听端口

func (*Client) KeepConnect

func (cli *Client) KeepConnect()

func (*Client) Service

func (cli *Client) Service(s string) RemoteService

Service 构造一个服务

func (*Client) Sign

func (cli *Client) Sign(name string, in interface{})

Sign 注册服务

func (*Client) TestCall

func (cli *Client) TestCall(service, fun string, param ...interface{}) (res interface{}, err error)

func (*Client) Wait

func (cli *Client) Wait()

type RemoteCallHandler

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

RemoteCallHandler 用来处理远程调用 接受的是center发来的请求

type RemoteFun

type RemoteFun = func(param ...interface{}) (interface{}, error)

远程函数

type RemoteService

type RemoteService struct {
	Service string
	// contains filtered or unexported fields
}

RemoteService 远程服务

func (RemoteService) FunAsync

func (s RemoteService) FunAsync(f string) func(Callback, ...interface{})

FunAsync 返回一个异步函数

func (RemoteService) FunSync

func (s RemoteService) FunSync(f string) RemoteFun

FunSync 返回一个同步函数

func (RemoteService) FunTest

func (s RemoteService) FunTest(f string) RemoteFun

type Request

type Request struct {
	Service string
	Fun     string
	Param   []interface{}
}

type RequestHandler

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

RequestHandler 处理本地请求

type ResponseHandler

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

type WaitChan

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

WaitChan 根据uuid获得响应的回调 并发安全

func NewWaitChan

func NewWaitChan(len uint) *WaitChan

构造函数

func (*WaitChan) Get

func (w *WaitChan) Get(k string) (callback WaitFun, ok bool)

Get 取

func (*WaitChan) Remove

func (w *WaitChan) Remove(k string)

Remove 删

func (*WaitChan) Set

func (w *WaitChan) Set(k string, callback WaitFun)

Set 加

type WaitFun

type WaitFun = func(interface{}, int)

Directories

Path Synopsis
cmd
client1
client1 main
client1 main
service
main
main
test
test
test

Jump to

Keyboard shortcuts

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