Documentation ¶
Index ¶
- Variables
- func ExLookupRpcClientSet(ctx context.Context, b bus.Bus, serviceID, clientID string) (*srpc.ClientSet, directive.Reference, error)
- type ClientController
- func (c *ClientController) Close() error
- func (c *ClientController) Execute(rctx context.Context) (rerr error)
- func (c *ClientController) GetClient() *srpc.PrefixClient
- func (c *ClientController) GetControllerInfo() *controller.Info
- func (c *ClientController) HandleDirective(ctx context.Context, inst directive.Instance) ([]directive.Resolver, error)
- type Invoker
- type InvokerController
- func (c *InvokerController) Close() error
- func (c *InvokerController) Execute(rctx context.Context) (rerr error)
- func (c *InvokerController) GetControllerInfo() *controller.Info
- func (c *InvokerController) HandleDirective(ctx context.Context, inst directive.Instance) ([]directive.Resolver, error)
- func (c *InvokerController) InvokeMethod(serviceID, methodID string, strm srpc.Stream) (bool, error)
- type LookupRpcClient
- type LookupRpcClientResolver
- type LookupRpcClientValue
- type LookupRpcService
- type LookupRpcServiceResolver
- type LookupRpcServiceValue
Constants ¶
This section is empty.
Variables ¶
ErrServiceClientUnavailable is returned if no clients are available for a service.
Functions ¶
func ExLookupRpcClientSet ¶
func ExLookupRpcClientSet(ctx context.Context, b bus.Bus, serviceID, clientID string) (*srpc.ClientSet, directive.Reference, error)
ExLookupRpcClientSet executes the LookupRpcClient directive returning a ClientSet. Returns ErrServiceClientUnavailable if no clients are returned.
Types ¶
type ClientController ¶
type ClientController struct {
// contains filtered or unexported fields
}
ClientController wraps a srpc.Client and serves LookupRpcClient requests.
func NewClientController ¶
func NewClientController( le *logrus.Entry, bus bus.Bus, info *controller.Info, client srpc.Client, matchServicePrefixes []string, ) *ClientController
NewClientController constructs a new controller.
func (*ClientController) Close ¶
func (c *ClientController) Close() error
Close releases any resources used by the controller. Error indicates any issue encountered releasing.
func (*ClientController) Execute ¶
func (c *ClientController) Execute(rctx context.Context) (rerr error)
Execute executes the controller. Returning nil ends execution.
func (*ClientController) GetClient ¶
func (c *ClientController) GetClient() *srpc.PrefixClient
GetClient returns the prefixed client.
func (*ClientController) GetControllerInfo ¶
func (c *ClientController) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*ClientController) HandleDirective ¶
func (c *ClientController) HandleDirective( ctx context.Context, inst directive.Instance, ) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive.
type Invoker ¶
type Invoker struct {
// contains filtered or unexported fields
}
Invoker implements the RPC invoker with a directive.
func NewInvoker ¶
NewInvoker constructs a new rpc method invoker. clientID can be empty, will be used for directives.
type InvokerController ¶
type InvokerController struct {
// contains filtered or unexported fields
}
InvokerController wraps a srpc.Invoker and serves LookupRpcService requests.
func NewInvokerController ¶
func NewInvokerController( le *logrus.Entry, bus bus.Bus, info *controller.Info, invoker srpc.Invoker, matchServicePrefixes []string, ) *InvokerController
NewInvokerController constructs a new controller.
func (*InvokerController) Close ¶
func (c *InvokerController) Close() error
Close releases any resources used by the controller. Error indicates any issue encountered releasing.
func (*InvokerController) Execute ¶
func (c *InvokerController) Execute(rctx context.Context) (rerr error)
Execute executes the controller. Returning nil ends execution.
func (*InvokerController) GetControllerInfo ¶
func (c *InvokerController) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*InvokerController) HandleDirective ¶
func (c *InvokerController) HandleDirective( ctx context.Context, inst directive.Instance, ) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive.
func (*InvokerController) InvokeMethod ¶
func (c *InvokerController) InvokeMethod(serviceID, methodID string, strm srpc.Stream) (bool, error)
InvokeMethod invokes the method matching the service & method ID. Returns false, nil if not found. If service string is empty, ignore it.
type LookupRpcClient ¶
type LookupRpcClient interface { // Directive indicates LookupRpcClient is a directive. directive.Directive // LookupRpcServiceID returns the ID of the service. // Cannot be empty. LookupRpcServiceID() string // LookupRpcClientID returns the identifier of the caller. // Use this for call routing only, not authentication. // Can be empty. LookupRpcClientID() string }
LookupRpcClient is a directive to lookup a RPC client for a service.
func NewLookupRpcClient ¶
func NewLookupRpcClient(serviceID, clientID string) LookupRpcClient
NewLookupRpcClient constructs a new LookupRpcClient directive.
type LookupRpcClientResolver ¶
type LookupRpcClientResolver = *directive.ValueResolver[LookupRpcClientValue]
LookupRpcClientResolver resolves LookupRpcClient with an Invoker.
func NewLookupRpcClientResolver ¶
func NewLookupRpcClientResolver(client srpc.Client) LookupRpcClientResolver
NewLookupRpcClientResolver constructs a new LookupRpcClientResolver directive.
type LookupRpcClientValue ¶
LookupRpcClientValue is the result type for LookupRpcClient. Multiple results may be pushed to the directive.
func ExLookupRpcClient ¶
func ExLookupRpcClient( ctx context.Context, b bus.Bus, serviceID, clientID string, ) ([]LookupRpcClientValue, directive.Reference, error)
ExLookupRpcClient executes the LookupRpcClient directive. Returns if the directive becomes idle (most likely: service not found). If no values are returned, returns nil, nil, nil If values are returned, returns vals, valsRef, nil Otherwise returns nil, nil, err
type LookupRpcService ¶
type LookupRpcService interface { // Directive indicates LookupRpcService is a directive. directive.Directive // LookupRpcServiceID returns the service ID to load. // Cannot be empty. LookupRpcServiceID() string // LookupRpcServerID returns the ID of the server requesting the service. // Use this for call routing only, not authentication. // Can be empty. LookupRpcServerID() string }
LookupRpcService is a directive to lookup a RPC service for a server.
func NewLookupRpcService ¶
func NewLookupRpcService(serviceID, serverID string) LookupRpcService
NewLookupRpcService constructs a new LookupRpcService directive.
type LookupRpcServiceResolver ¶
type LookupRpcServiceResolver = *directive.ValueResolver[LookupRpcServiceValue]
LookupRpcServiceResolver resolves LookupRpcService with an Invoker.
func NewLookupRpcServiceResolver ¶
func NewLookupRpcServiceResolver(invoker srpc.Invoker) LookupRpcServiceResolver
NewLookupRpcServiceResolver constructs a new LookupRpcServiceResolver directive.
type LookupRpcServiceValue ¶
LookupRpcServiceValue is the result type for LookupRpcService. Multiple results may be pushed to the directive.
func ExLookupRpcService ¶
func ExLookupRpcService( ctx context.Context, b bus.Bus, serviceID, serverID string, ) ([]LookupRpcServiceValue, directive.Reference, error)
ExLookupRpcService executes the LookupRpcService directive. Returns if the directive becomes idle (most likely: service not found). If no values are returned, returns nil, nil, nil If values are returned, returns vals, valsRef, nil Otherwise returns nil, nil, err