跳转到正文

bus API ​

完整接口目录 · 插件运行时用法 · 工具包下载

模块说明 ​

text
Native typed Bus calls over bounded receipts, with no automatic replay.

Bus ​

python
class Bus

Bus.__init__ ​

python
def __init__(self, peer, registry=None)

Bus.watch ​

python
async def watch(self, member, *, snapshot_type, delta_type, major=1, provider=None)

SDK 说明:

text
Open a Worker-owned atomic view after Host starts this active run.

Bus.projection ​

python
async def projection(
    self,
    member,
    *,
    reducer,
    snapshot_type,
    delta_type,
    major = 1,
    provider = None,
)

SDK 说明:

text
Open a display projection that automatically replaces invalid cursors.

Bus.watch_async ​

python
def watch_async(self, member, **options)

SDK 说明:

text
Stage an async callback taking one ViewUpdate, during on_init.

Bus.watch_sync ​

python
def watch_sync(self, member, **options)

SDK 说明:

text
Stage a synchronous callback; its thread is joined during drain.

Bus.provide ​

python
def provide(self, handler, **options)

Bus.service ​

python
def service(self, name, **options)

Bus.read ​

python
def read(self, name, **options)

Bus.publish ​

python
def publish(self, name, **options)

Bus.on_bus_data ​

python
def on_bus_data(self, name, **options)

Bus.on_bus_data_async ​

python
def on_bus_data_async(self, name, **options)

Bus.on_packet ​

python
def on_packet(self, packet_type, **options)

Bus.on_packet_async ​

python
def on_packet_async(self, packet_type, **options)

Bus.stream_status ​

python
def stream_status(self)

SDK 说明:

text
Return immutable stream snapshots, including local terminal reasons.

Bus.catalog ​

python
async def catalog(self)

SDK 说明:

text
Get the Host's current visible directory; identities are Host-owned.

Bus.prepare_op ​

python
def prepare_op(
    self,
    member,
    arguments = EmptyRequest(),
    *,
    intent,
    request_type = None,
    major = 1,
    provider = None,
)

SDK 说明:

text
Freeze a complete typed leaf intent without IO or admission.

Pass the returned OperationIntent to Transaction.action() to commit it
atomically with state. The contract, tagged arguments, optional provider
and original intent's session/deadline/cause are retained unchanged.
Host validation and admission happen only when that transaction saves.

Bus.call ​

python
async def call(
    self,
    member,
    arguments = EmptyRequest(),
    *,
    result_type,
    request_type = None,
    major = 1,
    kind = 'service',
    provider = None,
    timeout = 30,
    intent = None,
)

SDK 说明:

text
Await one bound provider. Timeout/cancel never resubmits a call.

A request dataclass is inferred from arguments. Scalar widths or a
declared union require request_type explicitly. Use EmptyRequest for
handlers without business arguments. Call is never business input.
Catalog-generated classes and Binding declarations reuse their complete
request/result schema. A Value argument supplies that schema too; use
result_type=Value to receive a validated dynamic result.

kind='op' requires a retained OpIntent and result_type=OpAdmission. It
returns durable acceptance only. Use operations.get/wait explicitly;
timeout or cancellation never cancels or replays the operation.
Local timeout/cancellation joins the short admission RPC before returning.
Recover its original request and known ID with op_request/op_context.

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