外观
managed API
模块说明
text
Bounded asyncio JSON-lines peer for trusted managed workers (Python 3.10+).IPCError
python
class IPCError(Exception)SDK 说明:
text
IPC failed; admitted mutations may already have committed. Never auto-retry.另继承外部类型 Exception;其通用方法不在本 SDK 目录中重复展开。
IPCRejected
python
class IPCRejected(IPCError)IPCRejected.__init__
python
def __init__(self, code, request_id, retryable)IPCRejected.code
python
self.code公开实例属性,在 __init__ 中设置。
IPCRejected.request_id
python
self.request_id公开实例属性,在 __init__ 中设置。
IPCRejected.retryable
python
self.retryable公开实例属性,在 __init__ 中设置。
ManagedPeer
python
class ManagedPeerSDK 说明:
text
One event loop owns all methods. Reader and writer never run handlers.
Events and host requests have separate bounded queues. Consume events in one
serial handler task and host requests in a separate control task. CPU-blocking
handlers must not run on this loop. Queue overflow fails the connection;
nothing is dropped/acknowledged. Cancellation after admission closes the peer,
except normal Worker Drain waits for the existing reply/timeout before cancelling.ManagedPeer.__init__
python
def __init__(self, reader, writer, *, max_frame_bytes=1 << 20)ManagedPeer.handshake
python
async def handshake(self, *, timeout=10)SDK 说明:
text
First operation only. Await before starting handlers or business RPCs.ManagedPeer.call
python
async def call(self, method, payload, *, timeout=10)ManagedPeer.next_event
python
async def next_event(self)ManagedPeer.next_request
python
async def next_request(self)ManagedPeer.next_notification
python
async def next_notification(self)SDK 说明:
text
Control notifications (all methods except event), separate from business.ManagedPeer.reply
python
def reply(self, request_id, result)ManagedPeer.reject
python
def reject(self, request_id, code, *, details=None)ManagedPeer.close
python
async def close(self)ManagedPeer.reader
python
self.reader公开实例属性,在 __init__ 中设置。
ManagedPeer.writer
python
self.writer公开实例属性,在 __init__ 中设置。
ManagedPeer.max_frame_bytes
python
self.max_frame_bytes公开实例属性,在 __init__、_read 中设置。
open_stdio
python
async def open_stdio()SDK 说明:
text
Open the Host-selected managed transport (stdio by default).
In stdio mode stdout must contain protocol frames only; socket mode allows
diagnostic stdout. Socket credentials are consumed once, with no reconnect.
Duplicated descriptors are owned here. Caller must close the peer; input
transport and outstanding Windows synchronous I/O are closed with it.