Undocumented
| Class | |
An OperationHandler that is limited to responding synchronously. |
| Function | bind |
Give each operation handler method of a service handler class its own operation. |
| Function | collect |
Collect operation handler methods from a user service handler class. |
| Function | service |
Create a service definition from operation handler factory methods. |
| Function | validate |
Validate operation handler methods against a service definition. |
| Function | _wrap |
Undocumented |
| Function | _wrap |
Undocumented |
type[ ServiceHandlerT], service_definition: ServiceDefinition):
¶
Give each operation handler method of a service handler class its own operation.
The operation of each method reports service_definition as its service. The operation gets its name and types from the service definition. When service_cls inherits a method from a parent class, this function replaces the method on service_cls with a wrapper. Thus, the method of the parent class keeps its own operation.
Validate the methods against the service definition before you call this function.
type[ ServiceHandlerT], service: ServiceDefinition | None) -> dict[ str, Callable[ [ ServiceHandlerT], OperationHandler[ Any, Any]]]:
¶
Collect operation handler methods from a user service handler class.
str, user_methods: dict[ str, Callable[ [ ServiceHandlerT], OperationHandler[ Any, Any]]]) -> ServiceDefinition:
¶
Create a service definition from operation handler factory methods.
In general, users should have access to, or define, a service definition, and validate
their service handler against it by passing the service definition to the
@nexusrpc.handler.service_handler decorator. This function is used when
that is not the case.
type[ ServiceHandlerT], operation_handler_factories_by_method_name: dict[ str, Callable[ [ ServiceHandlerT], OperationHandler[ Any, Any]]], service_definition: ServiceDefinition):
¶
Validate operation handler methods against a service definition.
For every operation in service_definition:
- There must be a method in user_methods whose method name matches the method name from the service definition.
- The input and output types of the handler method must exactly match the types declared in the service definition.
Callable[ [ Any], OperationHandler[ Any, Any]], op: Operation[ Any, Any]) -> Callable[ [ Any], OperationHandler[ Any, Any]]:
¶
Undocumented