juturna.transport.browser package¶
Module contents¶
- class juturna.transport.browser.BrowserTransport(queue_capacity: int = 8, max_meta_json_bytes: int = 4096, max_payload_bytes: int = 2000000, remote_timeout: float = 30.0)¶
Bases:
objectTransport backend for a pipeline running in a browser (Pyodide)
- attach_queue(handle) _BrowserQueue¶
Attach to a queue created in another Worker, from its handle
- capabilities: ClassVar[frozenset[str]] = frozenset({'page_channel'})¶
- connect(node_name: str, handle) None¶
Register the handle of the inbound queue of a node of another Worker, as returned by its queue_handle(). Writes to that node’s destination wait for it. Calling it again for the same node, with the handle of a rebuilt node, makes the destination write to the new queue.
- is_current(handle: WorkerHandle) bool¶
- new_condition() _BrowserCondition¶
- new_event() _BrowserEvent¶
- new_lock() _BrowserLock¶
- new_queue(maxsize: int = 0, local: bool = False) _BrowserQueue | _BrowserLocalQueue¶
- node_scope(shared: bool)¶
Declare, for the queues built inside the block, whether the node they belong to is written to from another Worker. When it is not, a queue is local (see _BrowserLocalQueue); outside a block, or with
sharedtrue, it is a ring.
- queue_handle(queue: _BrowserQueue)¶
What to post to another Worker so it can attach_queue().
- remote_destination(node_name: str) _BrowserRemoteDestination¶
The destination standing for a node of another Worker, to be linked as if it were the node itself (see Pipeline.warmup).
- spawn(target: Callable[[], None], name: str, daemon: bool = True) _BrowserWorker¶
- juturna.transport.browser.decode_message(data: dict, creator: str) Message¶
Build a message from the dict produced by a page (or encode_message).
- Raises:
ValueError – If
kindis unknown or the payload has unexpected fields.
- juturna.transport.browser.encode_message(message: Message) dict¶
Turn a message into a dict of JSON-compatible values and flat arrays.
- Raises:
TypeError – If the payload type has no browser representation.