[Zenoh](https://zenoh.io) /zeno/ is a stack that unifies data in motion, data at rest and computations. It elegantly blends traditional pub/sub with geo distributed storage, queries and computations, while retaining a level of time and space efficiency that is well beyond any of the mainstream stacks.
Before delving into the examples, we need to introduce few Zenoh concepts.
First off, in Zenoh you will deal with Resources, where a resource is made up of a
key and a value. The other concept you'll have to familiarize yourself with are
key expressions, such as robot/sensor/temp
, robot/sensor/*
, robot/**
, etc.
As you can gather, the above key expression denotes set of keys, while the *
and **
are wildcards representing respectively (1) a single chunk (non-empty sequence of characters that doesn't contain /
), and (2) any amount of chunks (including 0).
Below are some examples that highlight these key concepts and show how easy it is to get started with.
>>> import zenoh
>>> z = zenoh.open()
>>> z.put('demo/example/hello', 'Hello World!')
>>> import zenoh, time
>>> def listener(sample):
>>> print(f"{sample.key_expr} => {sample.payload.decode('utf-8')}")
>>>
>>> z = zenoh.open()
>>> subscriber = z.subscribe('demo/example/**', listener)
>>> time.sleep(60)
>>> subscriber.undeclare()
>>> import zenoh
>>> z = zenoh.open()
>>> for response in z.get('demo/example/**', zenoh.Queue()):
>>> response = response.ok
>>> print(f"{response.key_expr} => {response.payload.decode('utf-8')}")
.. automodule:: zenoh :members: init_logger, open, scout
.. autoclass:: zenoh.Hello :members:
.. autoclass:: zenoh.Config :members:
.. autoclass:: zenoh.Session :members:
.. autoclass:: zenoh.Info :members:
.. autoclass:: zenoh.KeyExpr :members:
.. autoclass:: zenoh.Sample :members:
.. autoclass:: zenoh.SampleKind :members: :undoc-members:
.. autoclass:: zenoh.Value :members:
.. autoclass:: zenoh.Encoding :members: :undoc-members:
.. autoclass:: zenoh.Publisher :members:
.. autoclass:: zenoh.CongestionControl :members: :undoc-members:
.. autoclass:: zenoh.Priority :members: :undoc-members:
.. autoclass:: zenoh.Subscriber :members:
.. autoclass:: zenoh.PullSubscriber :members:
.. autoclass:: zenoh.Reliability :members: :undoc-members:
.. autoclass:: zenoh.Query :members:
.. autoclass:: zenoh.Selector :members:
.. autoclass:: zenoh.QueryTarget :members:
.. autoclass:: zenoh.QueryConsolidation :members:
.. autoclass:: zenoh.Reply :members:
.. autoclass:: zenoh.Queryable :members:
.. autoclass:: zenoh.ZenohId :members:
.. autoclass:: zenoh.Timestamp :members:
.. automodule:: zenoh :members: Queue, ListCollector, Closure, Handler, IClosure, IHandler, IValue