Skip to main content

RPC transport for Kollabor (StateService foundation)

Project description

kollabor-rpc

kollabor-rpc is the lightweight RPC transport foundation for Kollabor daemon and attach-mode state access.

It provides request/response models, error types, a method-dispatch server, a client, and Unix-socket transport helpers. The current package is intentionally small and stdlib-only.

Current Role

  • Represent RPC requests and responses with stable IDs.
  • Dispatch named methods to async handlers.
  • Provide client helpers for request/response calls.
  • Wrap common RPC errors such as timeout, missing method, and handler failure.
  • Provide Unix socket connection helpers with a larger buffer limit.

Architecture

Module Responsibility
models.py RpcRequest, RpcResponse, request ID helpers
errors.py RPC exception hierarchy
server.py handler registration and dispatch
client.py request client abstraction
transport.py Unix transport helpers and buffer settings

Usage

from kollabor_rpc import RpcServer

server = RpcServer()


async def ping(params):
    return {"ok": True, "echo": params.get("echo")}


server.register("ping", ping)
reply = await server.handle_wire({
    "request_id": "req_1",
    "method": "ping",
    "params": {"echo": "hello"},
})

Known Gaps

  • This package is still a transport foundation; higher-level StateService method contracts live outside the package.
  • Wire-format compatibility should be documented alongside the hub/attach socket protocol.
  • Current tests focus on integration through hub sockets; package-local unit coverage should grow as the API stabilizes.

Roadmap

Phase 1: Contract docs

  • Document the exact frame format used by attach clients and hub sockets.
  • Add examples for both direct dispatch and socket-backed clients.
  • Clarify which errors are transport failures versus handler failures.

Phase 2: StateService integration

  • Keep RPC generic, but document the StateService method namespace that uses it.
  • Add contract tests for high-value state methods.
  • Add compatibility checks for attached streaming and request/reply flows.

Phase 3: Operational hardening

  • Add timeout/cancellation guidance for callers.
  • Improve observability for slow handlers and failed frames.
  • Keep the package stdlib-only unless a transport dependency becomes essential.

Development

Targeted validation examples:

python -m py_compile packages/kollabor-rpc/src/kollabor_rpc/*.py
python -m pytest tests/test_hub_rpc_integration.py -q

Dependencies

None. This package is intentionally stdlib-only.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kollabor_rpc-1.0.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kollabor_rpc-1.0.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file kollabor_rpc-1.0.1.tar.gz.

File metadata

  • Download URL: kollabor_rpc-1.0.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kollabor_rpc-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b178843574bfdc28034df5fd0d14095f383119828eb0caf6424af711bad81611
MD5 ac6655332c3c16a856f115f2c12c17ea
BLAKE2b-256 c0a88d87677a456a3dc1c53bb2f164e4cc6e70793256cc5ef027e3d9a65854ef

See more details on using hashes here.

File details

Details for the file kollabor_rpc-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: kollabor_rpc-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kollabor_rpc-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b2dadf73be2a133e13f7e505005e38ea11ea5d097b7a81a7c4a7609e7de87cb
MD5 a45c2f22530015687e226d6e395b4b4b
BLAKE2b-256 e7ce05608f413baea6624cdec6940a84c9df6b6a4faf87791190c82987fccd9c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page