API Docs

Base Endpoint API

The Endpoint enables communication between different processes as well as within a single process via various event-driven APIs.

lahja.base.EndpointAPI.is_running
lahja.base.EndpointAPI.is_serving
lahja.base.EndpointAPI.name

Base class for endpoint implementations that implements shared/common logic

lahja.base.BaseEndpoint.is_running
lahja.base.BaseEndpoint.is_serving
lahja.base.BaseEndpoint.name

AsyncioEndpoint

ConnectionConfig

class lahja.common.ConnectionConfig

Bases: tuple

Configuration class needed to establish Endpoint connections.

classmethod from_name(name: str, base_path: Optional[pathlib.Path] = None) → lahja.common.ConnectionConfig
name

Alias for field number 0

path

Alias for field number 1

Exceptions

exception lahja.exceptions.BindError

Bases: lahja.exceptions.LahjaError

Raise when an attempt was made to bind an event that is already bound.

exception lahja.exceptions.ConnectionAttemptRejected

Bases: lahja.exceptions.LahjaError

Raised when an attempt was made to connect to an endpoint that is already connected.

exception lahja.exceptions.LahjaError

Bases: Exception

Base class for all lahja errors

exception lahja.exceptions.RemoteDisconnected

Bases: lahja.exceptions.LahjaError

Raise when a remote disconnects while we attempting to read a message.

exception lahja.exceptions.UnexpectedResponse

Bases: lahja.exceptions.LahjaError

Raised when the type of a response did not match the expected_response_type.

BaseEvent

class lahja.common.BaseEvent

Bases: object

bind(endpoint: EndpointAPI, id: Optional[NewType.<locals>.new_type]) → None
broadcast_config(internal: bool = False) → lahja.common.BroadcastConfig
get_origin() → str
is_bound = False

BaseRequestResponseEvent

class lahja.common.BaseRequestResponseEvent

Bases: abc.ABC, lahja.common.BaseEvent, typing.Generic

static expected_response_type() → Type[TResponse]

Return the type that is expected to be send back for this request. This ensures that at runtime, only expected responses can be send back to callsites that issued a BaseRequestResponseEvent

BroadcastConfig

class lahja.common.BroadcastConfig(filter_endpoint: Optional[str] = None, filter_event_id: Optional[NewType.<locals>.new_type] = None, internal: bool = False)

Bases: object

allowed_to_receive(endpoint: str) → bool

Subscription

class lahja.common.Subscription(unsubscribe_fn: Callable[Any])

Bases: object

unsubscribe() → None