Skip to content

Commit 0424a73

Browse files
authored
Added stream consumers. (#7)
1 parent 7e0c612 commit 0424a73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1996
-399
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
- uses: auguwu/clippy-action@1.4.0
4949
with:
5050
token: ${{secrets.GITHUB_TOKEN}}
51+
deny: warnings
5152
pytest:
5253
runs-on: ubuntu-latest
5354
steps:

Cargo.lock

Lines changed: 24 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ publish = false
1111
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1212
[lib]
1313
crate-type = ["cdylib"]
14-
name = "_inner"
14+
name = "_natsrpy_rs"
1515

1616
[dependencies]
1717
async-nats = "0.46"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ build-backend = "maturin"
3333
[tool.maturin]
3434
bindings = "pyo3"
3535
features = ["pyo3/extension-module"]
36-
module-name = "natsrpy._inner"
36+
module-name = "natsrpy._natsrpy_rs"
3737
python-source = "python"
3838

3939
[tool.mypy]

python/natsrpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from natsrpy._inner import Message, Nats, Subscription
1+
from natsrpy._natsrpy_rs import Message, Nats, Subscription
22

33
__all__ = [
44
"Message",

python/natsrpy/_inner/js/__init__.pyi

Lines changed: 0 additions & 23 deletions
This file was deleted.

python/natsrpy/_inner/message.pyi

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from datetime import timedelta
22
from typing import Any
33

4-
from natsrpy._inner.js import JetStream
5-
from natsrpy._inner.message import Message
4+
from natsrpy._natsrpy_rs.js import JetStream
5+
from natsrpy._natsrpy_rs.message import Message
66

77
class Subscription:
88
def __aiter__(self) -> Subscription: ...
@@ -28,7 +28,7 @@ class Nats:
2828
async def publish(
2929
self,
3030
subject: str,
31-
payload: bytes,
31+
payload: bytes | str | bytearray | memoryview,
3232
*,
3333
headers: dict[str, Any] | None = None,
3434
reply: str | None = None,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from typing import Any
2+
3+
from .managers import KVManager, StreamsManager
4+
5+
class JetStream:
6+
async def publish(
7+
self,
8+
subject: str,
9+
payload: str | bytes | bytearray | memoryview,
10+
*,
11+
headers: dict[str, str] | None = None,
12+
reply: str | None = None,
13+
err_on_disconnect: bool = False,
14+
) -> None: ...
15+
@property
16+
def kv(self) -> KVManager: ...
17+
@property
18+
def streams(self) -> StreamsManager: ...
19+
20+
class JetStreamMessage:
21+
@property
22+
def subject(self) -> str: ...
23+
@property
24+
def reply(self) -> str | None: ...
25+
@property
26+
def payload(self) -> bytes: ...
27+
@property
28+
def headers(self) -> dict[str, Any]: ...
29+
async def ack(self) -> None: ...

0 commit comments

Comments
 (0)