pamoja.core

The pamoja engine's surface: the runtime version, the error every native call raises, and the transport every link shares.

This is the counterpart of the pamoja-core crate, and like it, it is small; the compiled engine is pamoja-native, which this package depends on. Each capability is its own package (pamoja-mqtt gives pamoja.mqtt, and so on), and pamoja installs all of them.

A ladder rung, a fault injector, and a degraded link all take some transport. Python has no way to say "any transport", so one class holds whichever kind was built and dispatches to it. Composing consumes a transport, because the thing it is composed into owns it from then on; a consumed transport is emptied rather than left aliasing what now belongs to a ladder, so using one twice raises.

 1"""The pamoja engine's surface: the runtime version, the error every native call
 2raises, and the transport every link shares.
 3
 4This is the counterpart of the ``pamoja-core`` crate, and like it, it is small; the
 5compiled engine is ``pamoja-native``, which this package depends on. Each capability
 6is its own package (``pamoja-mqtt`` gives ``pamoja.mqtt``, and so on), and
 7``pamoja`` installs all of them.
 8
 9A ladder rung, a fault injector, and a degraded link all take some transport.
10Python has no way to say "any transport", so one class holds whichever kind was
11built and dispatches to it. Composing consumes a transport, because the thing it
12is composed into owns it from then on; a consumed transport is emptied rather
13than left aliasing what now belongs to a ladder, so using one twice raises.
14"""
15
16from __future__ import annotations
17
18from pamoja._native import Message, PamojaError, version
19from pamoja._native import PyTransport as Transport
20
21__all__ = ["Message", "PamojaError", "Transport", "version"]
class Message:

A message that arrived on a subscribed topic.

CoAP and the loopback broker both hand back a topic and a payload, so one class serves them rather than a near-identical type per transport.

payload

The raw payload bytes.

topic

The topic it was published to.

class PamojaError(builtins.Exception):

Raised when a pamoja operation fails.

Transport = <class 'builtins.PyTransport'>
def version():

Returns the version of the native pamoja module.