Skip to main content

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 stub.MyMethod.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 - Constant
  • CANCELED - Constant
  • UNKNOWN - Constant
  • INVALID_ARGUMENT - Constant
  • DEADLINE_EXCEEDED - Constant
  • NOT_FOUND - Constant
  • ALREADY_EXISTS - Constant
  • PERMISSION_DENIED - Constant
  • RESOURCE_EXHAUSTED - Constant
  • FAILED_PRECONDITION - Constant
  • ABORTED - Constant
  • OUT_OF_RANGE - Constant
  • UNIMPLEMENTED - Constant
  • INTERNAL - Constant
  • UNAVAILABLE - Constant
  • DATA_LOSS - Constant
  • UNAUTHENTICATED - Constant

grpc​

load("grpc", "grpc")

Functions​

client(target: String)​

Example:

grpc.client(target="localhost:50051")

Parameters:

NameTypeRequiredDescription
targetString✓

Returns: Client


service_stub(client: Client, descriptor: ServiceDescriptor)​

Example:

grpc.service_stub(client=conn, descriptor=my_pkg.MyService)

Parameters:

NameTypeRequiredDescription
clientClient✓
descriptorServiceDescriptor✓

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:

NameTypeRequiredDescription
reqMessage✓
retry_strategyStrategy
on_errorCallable

Returns: Tuple