mstar.communication.rust_communicator#

ZMQCommunicator over the Rust transport vendored in rust/ (mstar_rust.ZmqCommunicator) — drop-in for the pyzmq class: same constructor, methods, endpoints, and wire, so wrapped and unwrapped entities interoperate and migration can proceed one process at a time. The codec is a Codec (typed msgpack by default, so an edge can terminate in a Rust process); register_event_for_poll forwards the eventfd to the Rust poller; a readiness poll buffers any consumed message so nothing is dropped or reordered. Build: maturin develop --release in rust/ (see docs/installation.rst).

Module Attributes

BLOCKING_POLL_SLICE_MS

Slice bound for indefinite blocking waits.

Classes

RustZMQCommunicator(my_id, push_ids[, ...])

The pyzmq ZMQCommunicator surface over the Rust transport.

mstar.communication.rust_communicator.BLOCKING_POLL_SLICE_MS = 50#

Slice bound for indefinite blocking waits. Events (message / wakeup) end a slice immediately, so this is not a latency knob — it bounds how long one FFI poll can hold the thread, keeping Python signal handling and the timeout_s deadline check responsive. Matches wait_for_work’s tick.

class mstar.communication.rust_communicator.RustZMQCommunicator(my_id, push_ids, protocol=CommProtocol.IPC, ipc_socket_path_prefix='/tmp/mstar/', codec=None)[source]#

Bases: BaseCommunicator

The pyzmq ZMQCommunicator surface over the Rust transport.

Parameters:
event: EventWakeup | None#
get_all_new_messages(blocking=False, timeout_s=None)[source]#
Parameters:
Return type:

list

poll_for_messages(timeout_ms=20)[source]#

Block until a message is readable, a registered wakeup event fires, or timeout_ms elapses — whichever comes first. True when a message is available (buffered here, delivered by get_all_new_messages); a wakeup ends the poll early with False (the event is drained, exactly as in wait_for_work).

Parameters:

timeout_ms (int)

Return type:

bool

register_event_for_poll(event)[source]#
Parameters:

event (EventWakeup)

Return type:

None

send(entity_id, msg)[source]#

entity_id: worker_xyz, conductor, or api_server

Parameters:

entity_id (str)

Return type:

None

wait_for_work(timeout_ms=50)[source]#
Parameters:

timeout_ms (int)

Return type:

None