grpc
Package grpc provides gRPC client functionality for durable programs.
load("grpc", ...)
codes
codes exposes gRPC status codes as integer constants for inspecting call results.
Use these to check the status code returned by grpc.with_call,
e.g. if call.code == codes.NOT_FOUND.
For catching gRPC errors in ! functions, use load("error", "codes") instead.
load("grpc", "codes")
Constants
OK- ConstantCANCELED- ConstantUNKNOWN- ConstantINVALID_ARGUMENT- ConstantDEADLINE_EXCEEDED- ConstantNOT_FOUND- ConstantALREADY_EXISTS- ConstantPERMISSION_DENIED- ConstantRESOURCE_EXHAUSTED- ConstantFAILED_PRECONDITION- ConstantABORTED- ConstantOUT_OF_RANGE- ConstantUNIMPLEMENTED- ConstantINTERNAL- ConstantUNAVAILABLE- ConstantDATA_LOSS- ConstantUNAUTHENTICATED- Constant
grpc
load("grpc", "grpc")
Functions
client(target: String)
Example:
grpc.client(target="localhost:50051")
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
target | String | ✓ |
Returns: Client
service_stub(client: Client, descriptor: ServiceDescriptor)
Example:
grpc.service_stub(client=conn, descriptor=my_pkg.MyService)
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
client | Client | ✓ | |
descriptor | ServiceDescriptor | ✓ |
Returns: ServiceStub
Types
Client
ServiceStub
MethodStub
Attributes:
with_call(req: Message, retry_strategy: Strategy, on_error: Callable)
Example:
resp, call = stub.MyMethod.with_call(req=request)
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
req | Message | ✓ | |
retry_strategy | Strategy | ||
on_error | Callable |
Returns: Tuple