Skip to content

Latest commit

 

History

History
82 lines (46 loc) · 1.58 KB

File metadata and controls

82 lines (46 loc) · 1.58 KB

Core RPC

The core module provides the server, connection, transport interface, error types, and convenience functions for defining and running RPC services.

Typical Usage

Most users only need serve_pipe (testing) or connect (subprocess):

from vgi_rpc import serve_pipe, connect

# In-process (tests)
with serve_pipe(MyService, MyServiceImpl()) as proxy:
    proxy.my_method(arg=42)

# Subprocess
with connect(MyService, ["python", "worker.py"]) as proxy:
    proxy.my_method(arg=42)

For more control, use RpcServer and RpcConnection directly.

API Reference

RpcServer

::: vgi_rpc.rpc.RpcServer

RpcConnection

::: vgi_rpc.rpc.RpcConnection

RpcTransport

::: vgi_rpc.rpc.RpcTransport

RpcMethodInfo

::: vgi_rpc.rpc.RpcMethodInfo

MethodType

::: vgi_rpc.rpc.MethodType

Errors

::: vgi_rpc.rpc.RpcError

::: vgi_rpc.rpc.VersionError

Typed marker errors

These exception classes carry a stable error_kind class attribute that the wire serializer surfaces as the vgi_rpc.error_kind metadata key on the EXCEPTION-level batch. Clients can pattern-match the kind instead of substring-searching the error message.

::: vgi_rpc.rpc.MethodNotImplementedError

::: vgi_rpc.rpc.SessionLostError

::: vgi_rpc.rpc.ServerDrainingError

See also IPCError in the Serialization module.

CallStatistics

::: vgi_rpc.rpc.CallStatistics

Convenience Functions

::: vgi_rpc.rpc.run_server

::: vgi_rpc.rpc.connect

::: vgi_rpc.rpc.serve_pipe

::: vgi_rpc.rpc.describe_rpc

Constants

::: vgi_rpc.metadata.REQUEST_VERSION