跳转到正文

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 ManagedPeer

SDK 说明:

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.

Neomega · 使用、开发与参考文档