Documentation ¶
Index ¶
- Variables
- func Async(ctx context.Context, servicePath, serviceMethod string, args any) (call *client.Call, err error)
- func Broadcast(ctx context.Context, servicePath, serviceMethod string, args, reply any) (err error)
- func Call(ctx context.Context, servicePath, serviceMethod string, args, reply any) (err error)
- func CallWithAddress(address string, servicePath, serviceMethod string, args, reply any) (err error)
- func CallWithMetadata(req, res xshare.Metadata, servicePath, serviceMethod string, args, reply any) (err error)
- func CallWithServerId(ctx context.Context, sid int32, servicePath, serviceMethod string, ...) (err error)
- func Close() (err error)
- func Service(name string, handler ...interface{}) *registry.Service
- func Start() (err error)
- func XCall(ctx context.Context, servicePath, serviceMethod string, args, reply any) (err error)
- type Client
- func (this *Client) Multiple(address []string, ch chan *protocol.Message) (err error)
- func (this *Client) Peer2Peer(address string, ch chan *protocol.Message) error
- func (this *Client) Registry(selectMod client.SelectMode, selector client.Selector, registry Discovery, ...) (err error)
- func (this *Client) Start(discovery Discovery, ch chan *protocol.Message) (err error)
- type Context
- type Discovery
- type XClient
- func (xc *XClient) Async(ctx context.Context, servicePath, serviceMethod string, args any) (done *client.Call, err error)
- func (xc *XClient) Broadcast(ctx context.Context, servicePath, serviceMethod string, args, reply any) (err error)
- func (xc *XClient) Call(ctx context.Context, servicePath, serviceMethod string, args, reply any) (err error)
- func (xc *XClient) CallWithMetadata(req, res xshare.Metadata, servicePath, serviceMethod string, args, reply any) (err error)
- func (xc *XClient) Client(servicePath string) client.XClient
- func (xc *XClient) Close() (err error)
- func (xc *XClient) Has(servicePath string) bool
- func (xc *XClient) Reload() (err error)
- func (xc *XClient) Service(name string, handler ...interface{}) *registry.Service
- func (xc *XClient) Size() int
- func (xc *XClient) Start() (err error)
- func (xc *XClient) XCall(ctx context.Context, servicePath, serviceMethod string, args any, reply any) error
Constants ¶
This section is empty.
Variables ¶
View Source
var Default = New(nil)
Functions ¶
func Async ¶ added in v0.0.5
func Async(ctx context.Context, servicePath, serviceMethod string, args any) (call *client.Call, err error)
Async 异步调用,仅仅调用无返回值
func CallWithAddress ¶ added in v0.0.5
func CallWithAddress(address string, servicePath, serviceMethod string, args, reply any) (err error)
CallWithAddress 通过服务器地址发消息
func CallWithMetadata ¶ added in v0.0.5
func CallWithMetadata(req, res xshare.Metadata, servicePath, serviceMethod string, args, reply any) (err error)
CallWithMetadata 自定义metadata
Types ¶
type Client ¶
type Client struct { Option client.Option FailMode client.FailMode Selector interface{} //client.Selector OR client.SelectMode OR address(Peer2Peer MultipleServers) Discovery client.ServiceDiscovery ServicePath string // contains filtered or unexported fields }
type Context ¶ added in v0.0.3
func (*Context) ServiceMethod ¶ added in v0.0.3
func (*Context) ServicePath ¶ added in v0.0.3
type Discovery ¶
type Discovery func() (client.ServiceDiscovery, error)
Discovery 注册中心服务发现,点对点或者点对多时无需设置
type XClient ¶
type XClient struct { Binder binder.Interface Registry *registry.Registry Discovery Discovery // contains filtered or unexported fields }
func (*XClient) Async ¶ added in v0.0.3
func (xc *XClient) Async(ctx context.Context, servicePath, serviceMethod string, args any) (done *client.Call, err error)
Async 异步
func (*XClient) CallWithMetadata ¶ added in v0.0.5
Click to show internal directories.
Click to hide internal directories.