juturna.transport package

Module contents

class juturna.transport.Condition(*args, **kwargs)

Bases: Protocol

A lock with wait/notify semantics, used to track pending work.

notify_all() None
wait_for(predicate: Callable[[], bool], timeout: float | None = None) None
exception juturna.transport.Empty

Bases: Exception

Raised by Queue.get() when no item is available within the timeout.

class juturna.transport.Lock(*args, **kwargs)

Bases: Protocol

A mutual exclusion primitive, used as a context manager.

class juturna.transport.Queue(*args, **kwargs)

Bases: Protocol

A FIFO channel used to move messages between nodes and workers.

empty() bool
full() bool
get(timeout: float | None = None) Any
get_nowait() Any
put(item: Any, timeout: float | None = None) None
qsize() int
class juturna.transport.Signal(*args, **kwargs)

Bases: Protocol

A boolean flag shared across workers, used to signal stop conditions.

clear() None
is_set() bool
set() None
wait(timeout: float | None = None) bool
class juturna.transport.ThreadingTransport

Bases: object

Default transport backend, based on real OS threads.

This backend preserves the current concurrency model of Node and Buffer: every worker runs on its own threading.Thread, and queues are backed by queue.Queue.

is_current(handle: WorkerHandle) bool
new_condition() _ThreadCondition
new_lock() _ThreadLock
new_queue(maxsize: int = 0) _ThreadQueue
new_signal() _ThreadSignal
spawn(target: Callable[[], None], name: str, daemon: bool = True) _ThreadWorker
class juturna.transport.TransportBackend(*args, **kwargs)

Bases: Protocol

Factory of concurrency primitives used by nodes and buffers.

An implementation decides how messages are moved and how workers are executed (e.g. real OS threads, or a cooperative scheduler); nodes and buffers only depend on this interface, never on the concrete primitives.

is_current(handle: WorkerHandle) bool
new_condition() Condition
new_lock() Lock
new_queue(maxsize: int = 0) Queue
new_signal() Signal
spawn(target: Callable[[], None], name: str, daemon: bool = True) WorkerHandle
class juturna.transport.WorkerHandle(*args, **kwargs)

Bases: Protocol

A handle to a unit of concurrent execution spawned by a backend.

is_alive() bool
join(timeout: float | None = None) None
start() None
juturna.transport.get_transport(name: str | None = None) TransportBackend

Resolve a transport backend by name.

Parameters:

name (str | None) – The name of the transport backend, as registered in _TRANSPORTS. Defaults to the threading backend if not provided.

Returns:

A new instance of the requested backend.

Return type:

TransportBackend

Raises:

ValueError – If name does not match any registered backend.