crossbar.interfaces¶
Interfaces used internally inside Crossbar.io to abstract/decouple different software components.
Note
These interfaces are solely for internal use and not exposed or supposed to be used by users or from outside.
Classes¶
Realm inventory interface. |
|
Interface to pending WAMP authentications. |
|
Interface to containers of routing realms the authentication system can query |
|
Realm store interface common to transient and persistent store implementations. |
Module Contents¶
- class IInventory[source]¶
Bases:
abc.ABCRealm inventory interface.
- property is_running: bool[source]¶
- Abstractmethod:
True if this realm inventory is currently running.
- Type:
return
- property repo: xbr._schema.FbsRepository[source]¶
- Abstractmethod:
return:
- abstractmethod start()[source]¶
Initialize and start this realm inventory.
Note
This procedure may or may not run asynchronously depending on inventory type.
- class IPendingAuth[source]¶
Bases:
abc.ABCInterface to pending WAMP authentications.
- abstractmethod authenticate(signature: str) autobahn.wamp.types.Accept | autobahn.wamp.types.Deny[source]¶
The client has answered with a WAMP AUTHENTICATE message. Verify the message and accept or deny.
- Parameters:
signature – Signature over the challenge as received from the authenticating session.
- Returns:
Either accept or deny the session.
- abstractmethod hello(realm: str, details: autobahn.wamp.types.HelloDetails) autobahn.wamp.types.Accept | autobahn.wamp.types.Deny | autobahn.wamp.types.Challenge[source]¶
When a HELLO message is received, this gets called to open the pending authentication.
- Parameters:
realm – The realm to client wishes to join (if the client did announce a realm).
details – The details of the client provided for HELLO.
- Returns:
Either return a challenge, or immediately accept or deny session.
- class IRealmContainer[source]¶
Bases:
abc.ABCInterface to containers of routing realms the authentication system can query about the existence of realms and roles during authentication.
- property config: autobahn.wamp.types.ComponentConfig[source]¶
- Abstractmethod:
Return the realm container configuration.
- Type:
return
- abstractmethod get_controller_session() autobahn.wamp.interfaces.ISession[source]¶
Returns a control session connected to the local node management router. Control sessions are used for:
registering the realm container control interface
access the node security module
- Returns:
A control session joined on the local node controller management realm, named “crossbar”.
- abstractmethod get_service_session(realm: str, role: str) autobahn.wamp.interfaces.ISession[source]¶
Returns a service session on the given realm using the given role. Service sessions are used for:
access dynamic authenticators (see :method:`crossbar.router.auth.pending.PendingAuth._init_dynamic_authenticator`)
access the WAMP meta API for the realm (see :method:`crossbar.worker.router.RouterController.start_router_realm`)
forward to/from WAMP for the HTTP bridge (see
crossbar.webservice.rest.RouterWebServiceRestPublisher,crossbar.webservice.rest.RouterWebServiceRestCaller,crossbar.webservice.rest.RouterWebServiceWebhook)
- Parameters:
realm – WAMP realm name.
role – WAMP authentication role name.
- Returns:
A service session joined on the given realm and role.
- abstractmethod has_realm(realm: str) bool[source]¶
Check if a route to a realm with the given name is currently running.
- Parameters:
realm – Realm name (the WAMP name, _not_ the run-time object ID).
- Returns:
True if a route to the realm (for any role) exists.
- abstractmethod has_role(realm: str, authrole: str) bool[source]¶
Check if a role with the given name is currently running in the given realm.
- Parameters:
realm – WAMP realm (the WAMP name, _not_ the run-time object ID).
authrole – WAMP authentication role (the WAMP URI, _not_ the run-time object ID).
- Returns:
True if a route to the realm for the role exists.
- class IRealmStore[source]¶
Bases:
abc.ABCRealm store interface common to transient and persistent store implementations.
- abstractmethod attach_subscription_map(subscription_map: crossbar.router.observation.UriObservationMap)[source]¶
- Parameters:
subscription_map
- Returns:
- abstractmethod get_event_history(subscription_id: int, from_ts: int, until_ts: int, reverse: bool | None = None, limit: int | None = None) List[Dict[str, Any]] | None[source]¶
Retrieve event history for time range for a given subscription.
If no history is maintained for the given subscription, None is returned.
- Parameters:
subscription_id – The ID of the subscription to retrieve events for.
from_ts – Filter events from this date (epoch time in ns).
until_ts – Filter events until before this date (epoch time in ns).
reverse
limit
- abstractmethod get_events(subscription_id: int, limit: int | None = None)[source]¶
Retrieve given number of last events for a given subscription.
If no events are yet stored, an empty list
[]is returned. If no history is maintained at all for the given subscription,Noneis returned.This procedure is called by the service session of Crossbar.io and exposed under the WAMP meta API procedure
wamp.subscription.get_events.- Parameters:
subscription_id – The ID of the subscription to retrieve events for.
limit – Limit number of events returned.
- Returns:
List of events: at most
limitevents in reverse chronological order.
- abstractmethod get_session_by_session_id(session_id: int, joined_at: int | None = None) Dict[str, Any] | None[source]¶
Get session information by WAMP session ID. If there is no session stored, return
None.Note
In the rare event there is more than one session for the same WAMP session ID (which may happen as the WAMP session ID is effectively 56 bit), the procedure will return the information for the session with the most recent
joined_attimestamp.- Parameters:
session_id – The WAMP session ID of the session for which to return information.
joined_at – If there are more than one session for the given
session_id, only return the session with the given joining timestamp (or newer).
- Returns:
A set of information for the stored session.
- abstractmethod get_sessions_by_authid(authid: str) List[Tuple[str, int]] | None[source]¶
Return session IDs and session joined timestamps given a WAMP authid, ordered by timestamps in reverse chronological order.
- Parameters:
authid – The WAMP authid to retrieve sessions for.
- Returns:
List of pairs
(session_id, joined_at)orNoneif there are no sessions stored for the givenauthid.
- property is_running: bool[source]¶
- Abstractmethod:
True if this realm store is currently running.
- Type:
return
- abstractmethod maybe_queue_call(session: autobahn.wamp.interfaces.ISession, call, registration, authorization)[source]¶
- Parameters:
session
call
registration
authorization
- Returns:
- abstractmethod start()[source]¶
Initialize and start this realm store.
Note
This procedure may or may not run asynchronously depending on store type.
- abstractmethod stop()[source]¶
Stop this realm store and retain all data.
Note
This procedure may or may not run asynchronously depending on store type.
- abstractmethod store_event(session: autobahn.wamp.interfaces.ISession, publication_id: int, publish: autobahn.wamp.message.Publish)[source]¶
Store event to event history.
- Parameters:
session – The publishing session.
publication_id – The WAMP publication ID under which the publish-action happens.
publish – The WAMP publish message.
- abstractmethod store_event_history(publication_id: int, subscription_id: int, receiver: autobahn.wamp.interfaces.ISession)[source]¶
Store publication history for subscription.
- Parameters:
publication_id – The ID of the event publication to be persisted.
subscription_id – The ID of the subscription the event (identified by the publication ID), was published to, because the event’s topic matched the subscription.
receiver – The receiving session.
- abstractmethod store_session_joined(session: autobahn.wamp.interfaces.ISession, details: autobahn.wamp.types.SessionDetails)[source]¶
- Parameters:
session – Session that has joined a realm.
details – Session details of the joined session.
- abstractmethod store_session_left(session: autobahn.wamp.interfaces.ISession, details: autobahn.wamp.types.CloseDetails)[source]¶
- Parameters:
session – Session that has left a realm it was previously joined on.
details – Session close details.