Skip to content

feat: add asyncio client in orbita.aio - #1

Open
bradhe wants to merge 1 commit into
mainfrom
feat/async-client
Open

feat: add asyncio client in orbita.aio#1
bradhe wants to merge 1 commit into
mainfrom
feat/async-client

Conversation

@bradhe

@bradhe bradhe commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Adds the asyncio API in orbita.aio, mirroring the synchronous client method-for-method on grpc.aio.

What

  • orbita.aio.Client / Keyspace: get, get_entry, set, delete, list_page, pages (async iterator), readiness
  • orbita.aio.AdminClient: full Admin surface
  • Transport gains open_aio_channel and retry_read_aio with the same posture: retry only read-only calls on UNAVAILABLE, never retry mutations, raise AmbiguousMutationError when the outcome is unknowable
  • Result and error types are shared with the sync client, so nothing needs translating when moving between the two

Why the connection setup differs

__init__ cannot await, so the async data client records configuration and performs the GetLimits handshake in connect(); async with connects on entry. Calls before connecting raise a clear RuntimeError. Admin has no handshake, so its channel opens eagerly and only close is managed.

Testing

  • 16 new unit tests against the in-process gRPC server (pytest-asyncio, shared fixture)
  • Async integration test added and verified locally against the pinned server image with ORBITA_REQUIRE_AUTH=true: 2 passed
  • ruff check, ruff format --check, mypy (strict), pytest all green

Mirror the synchronous API method-for-method on grpc.aio, sharing the
result dataclasses, validation helpers, and error types so an
application can move between the two without translating anything. The
transport grows an aio channel opener and an asyncio retry loop with
the same read-only-retry and ambiguous-mutation posture.

The one structural difference is connection setup: __init__ cannot
await, so the data client records configuration and performs the limits
handshake in connect(), with async-with connecting on entry. Admin has
no handshake, so its channel still opens eagerly.

Unit tests reuse the in-process sync gRPC server through pytest-asyncio,
and the integration suite gains an async pass verified against the
pinned server image.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant