Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Nov 29, 2024
1 parent 5fd57e4 commit 99b4ca0
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ pub(crate) mod zenoh {
pubsub::{Publisher, Subscriber},
qos::{CongestionControl, Priority, Reliability},
query::{
ConsolidationMode, Parameters, Query, QueryConsolidation, QueryTarget, Queryable,
Reply, ReplyError, Selector,
ConsolidationMode, Parameters, Querier, Query, QueryConsolidation, QueryTarget,
Queryable, Reply, ReplyError, Selector,
},
sample::{Sample, SampleKind},
scouting::{scout, Hello, Scout},
Expand Down
61 changes: 61 additions & 0 deletions zenoh/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,54 @@ class Queryable(Generic[_H]):
@overload
def __iter__(self) -> Never: ...

@final
class Querier:
"""A querier that allows to send queries to a queryable..
Queriers are automatically undeclared when dropped."""

def __enter__(self) -> Self: ...
def __exit__(self, *_args, **_kwargs): ...
@property
def key_expr(self) -> KeyExpr: ...
@overload
def get(
self,
handler: _RustHandler[Reply] | None = None,
*,
parameters: _IntoParameters | None = None,
payload: _IntoZBytes | None = None,
encoding: _IntoEncoding | None = None,
attachment: _IntoZBytes | None = None,
) -> Handler[Reply]:
"""Sends a query."""

@overload
def get(
self,
handler: _PythonHandler[Reply, _H],
*,
parameters: _IntoParameters | None = None,
payload: _IntoZBytes | None = None,
encoding: _IntoEncoding | None = None,
attachment: _IntoZBytes | None = None,
) -> _H:
"""Sends a query."""

@overload
def get(
self,
handler: _PythonCallback[Reply],
*,
parameters: _IntoParameters | None = None,
payload: _IntoZBytes | None = None,
encoding: _IntoEncoding | None = None,
attachment: _IntoZBytes | None = None,
) -> None:
"""Send a query."""

def undeclare(self):
"""Undeclares the Querier, informing the network that it needn't optimize queries for its key expression anymore."""

@final
class QueryConsolidation:
AUTO: Self
Expand Down Expand Up @@ -896,6 +944,19 @@ class Session:
) -> Publisher:
"""Create a Publisher for the given key expression."""

def declare_querier(
self,
key_expr: _IntoKeyExpr,
*,
target: QueryTarget | None = None,
consolidation: _IntoQueryConsolidation | None = None,
timeout: float | int | None = None,
congestion_control: CongestionControl | None = None,
priority: Priority | None = None,
express: bool | None = None,
) -> Querier:
"""Create a Querier for the given key expression."""

def liveliness(self) -> Liveliness:
"""Obtain a Liveliness instance tied to this Zenoh session."""

Expand Down

0 comments on commit 99b4ca0

Please sign in to comment.