跳转到正文

bulk API ​

完整接口目录 · 世界与方块用法 · 工具包下载

模块说明 ​

text
Bounded, loopback-only binary transfers, independent of the control peer.

Sources and sinks run in IO threads and must cooperate by returning promptly.
Bytes are provisional until consume succeeds: stage output before publishing it.
Cancellation interrupts sockets, not arbitrary Python code; aclose joins actual
workers, so a noncooperative source or sink can delay shutdown. No retry occurs.

BulkError ​

python
class BulkError(Exception)

SDK 说明:

text
A transfer failed; sink output must be discarded.

另继承外部类型 Exception;其通用方法不在本 SDK 目录中重复展开。

BulkClient ​

python
class BulkClient

SDK 说明:

text
Own one event loop; max_bytes bounds each transfer, not retained sink data.

BulkClient.__init__ ​

python
def __init__(self, *, max_transfers=2, max_waiters=32, max_bytes=16 << 20, timeout=30)

BulkClient.owned_threads ​

python
def owned_threads(self)

SDK 说明:

text
Snapshot actual owned thread objects for a surrounding domain owner.

BulkClient.consume ​

python
async def consume(self, descriptor, sink)

BulkClient.upload ​

python
async def upload(self, descriptor, source)

SDK 说明:

text
Upload bytes or a borrowed synchronous read(n) stream; return its ref.

Reads use at most 64 KiB and never close the source. Active failures
release the upload grant; success retains it for Host consumption.
Descriptor rejection or cancellation before admission leaves TTL cleanup.

BulkClient.aclose ​

python
async def aclose(self)

BulkClient.__aenter__ ​

python
async def __aenter__(self)

BulkClient.__aexit__ ​

python
async def __aexit__(self, *args)

snapshot ​

python
async def snapshot(peer, key)

SDK 说明:

text
Request a cached snapshot descriptor; unsupported RPC propagates explicitly.

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