Documentation
¶
Index ¶
- Variables
- func OneWayRPC(servCtx service.Context, dst, path string, args ...any) error
- func RPC(servCtx service.Context, dst, path string, args ...any) runtime.AsyncRet
- func Result(ret runtime.Ret) (any, error)
- func Results(ret runtime.Ret) ([]any, error)
- type DistributedDeliverer
- func (d *DistributedDeliverer) Init(ctx service.Context)
- func (d *DistributedDeliverer) Match(ctx service.Context, dst, path string, oneWay bool) bool
- func (d *DistributedDeliverer) Notify(ctx service.Context, dst, path string, args []any) error
- func (d *DistributedDeliverer) Request(ctx service.Context, dst, path string, args []any) runtime.AsyncRet
- func (d *DistributedDeliverer) Shut(ctx service.Context)
- type DistributedDispatcher
- type IDeliverer
- type IDispatcher
- type IRPC
- type LifecycleInit
- type LifecycleShut
- type Option
- type RPCOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Name = plugin.Name Using = plugin.Using Install = plugin.Install Uninstall = plugin.Uninstall )
View Source
var ( ErrPluginNotFound = errors.New("rpc: plugin not found") ErrMethodNotFound = errors.New("rpc: method not found") ErrComponentNotFound = errors.New("rpc: component not found") ErrMethodParameterCountMismatch = errors.New("rpc: method parameter count mismatch") ErrMethodParameterTypeMismatch = errors.New("rpc: method parameter type mismatch") )
View Source
var (
ErrNoDeliverer = errors.New("rpc: no deliverer") // 没有匹配的投递器
)
Functions ¶
Types ¶
type DistributedDeliverer ¶
type DistributedDeliverer struct {
// contains filtered or unexported fields
}
DistributedDeliverer 分布式服务的RPC投递器
func (*DistributedDeliverer) Init ¶
func (d *DistributedDeliverer) Init(ctx service.Context)
Init 初始化
func (*DistributedDeliverer) Request ¶
func (d *DistributedDeliverer) Request(ctx service.Context, dst, path string, args []any) runtime.AsyncRet
Request 请求
func (*DistributedDeliverer) Shut ¶
func (d *DistributedDeliverer) Shut(ctx service.Context)
Shut 结束
type DistributedDispatcher ¶
type DistributedDispatcher struct {
// contains filtered or unexported fields
}
DistributedDispatcher 分布式服务的RPC分发器
func (*DistributedDispatcher) Init ¶
func (d *DistributedDispatcher) Init(ctx service.Context)
Init 初始化
func (*DistributedDispatcher) Shut ¶
func (d *DistributedDispatcher) Shut(ctx service.Context)
Shut 结束
type IDeliverer ¶
type IDeliverer interface { // Match 是否匹配 Match(ctx service.Context, dst, path string, oneWay bool) bool // Request 请求 Request(ctx service.Context, dst, path string, args []any) runtime.AsyncRet // Notify 通知 Notify(ctx service.Context, dst, path string, args []any) error }
IDeliverer RPC投递器接口,用于将RPC投递至目标
type IRPC ¶
type IRPC interface { // RPC RPC调用 RPC(dst, path string, args ...any) runtime.AsyncRet // OneWayRPC 单向RPC调用 OneWayRPC(dst, path string, args ...any) error }
IRPC RPC支持
type LifecycleInit ¶
LifecycleInit 生命周期开始
type LifecycleShut ¶
LifecycleShut 生命周期结束
type Option ¶
type Option struct{}
func (Option) Deliverers ¶
func (Option) Deliverers(deliverers ...IDeliverer) option.Setting[RPCOptions]
func (Option) Dispatchers ¶
func (Option) Dispatchers(dispatchers ...IDispatcher) option.Setting[RPCOptions]
type RPCOptions ¶
type RPCOptions struct { Deliverers []IDeliverer Dispatchers []IDispatcher }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.