Skip to content

Commit 3ea735c

Browse files
committed
Tmp commit.
1 parent 2b0d441 commit 3ea735c

28 files changed

Lines changed: 693 additions & 283 deletions

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2024"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77
[lib]
8-
name = "natsrpy"
8+
name = "_inner"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
@@ -17,4 +17,5 @@ pyo3 = { version = "0.28", features = ["abi3"] }
1717
pyo3-async-runtimes = { version = "0.28", features = ["tokio-runtime"] }
1818
pyo3-log = "0.13.3"
1919
thiserror = "2.0.18"
20+
time = "0.3.47"
2021
tokio = { version = "1.50.0", features = ["full"] }

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ build-backend = "maturin"
1616
[tool.maturin]
1717
bindings = "pyo3"
1818
python-source = "python"
19-
module-name = "natsrpy._internal"
19+
module-name = "natsrpy._inner"
2020
features = ["pyo3/extension-module"]

python/natsrpy/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
from ._internal import Nats
1+
from natsrpy._inner import (
2+
Nats,
3+
# JetStream,
4+
# Source,
5+
# External,
6+
Subscription,
7+
)
28

3-
__all__ = ["Nats"]
9+
__all__ = [
10+
"Nats",
11+
"Subscription",
12+
]
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from .jetstream import JetStream
2-
31
class Message:
42
subject: str
53
reply: str | None
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from .kv import KeyValue
2+
3+
class External:
4+
def __init__(
5+
self,
6+
api_prefix: str,
7+
delivery_prefix: str | None = None,
8+
) -> None: ...
9+
10+
class Source:
11+
def __init__(
12+
self,
13+
name: str,
14+
filter_subject: str | None = None,
15+
external: External | None = None,
16+
) -> None: ...
17+
18+
class JetStream:
19+
async def publish(
20+
self,
21+
subject: str,
22+
payload: bytes,
23+
*,
24+
headers: dict[str, str] | None = None,
25+
reply: str | None = None,
26+
err_on_disconnect: bool = False,
27+
) -> None: ...
28+
async def create_kv(
29+
self,
30+
bucket: str,
31+
description=None,
32+
max_value_size=None,
33+
history=None,
34+
max_age=None,
35+
max_bytes=None,
36+
storage=None,
37+
num_replicas=None,
38+
republish=None,
39+
mirror: Source | None = None,
40+
mirror_direct=None,
41+
compression=None,
42+
limit_markers=None,
43+
) -> KeyValue: ...
44+
async def get_kv(self, bucket: str) -> KeyValue: ...

python/natsrpy/_inner/js/kv.pyi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
class StorageType:
3+
FILE: "StorageType"
4+
MEMORY: "StorageType"
5+
6+
class KVConfig:
7+
def __init__(
8+
self,
9+
bucket: str,
10+
description: str | None = None,
11+
max_value_size: int | None = None,
12+
history:int|None=None,
13+
max_age:float |None=None,
14+
max_bytes:int |None=None,
15+
storage:StorageType|None=None,
16+
num_replicas: int |None=None,
17+
republish:bool |None=None,
18+
mirror:|None=None,
19+
sources:|None=None,
20+
mirror_direct:|None=None,
21+
compression:|None=None,
22+
placement:|None=None,
23+
limit_markers:|None=None,
24+
) -> None: ...
25+
26+
class KeyValue:
27+
async def get(self, key: str) -> bytes | None: ...
28+
async def put(self, key: str, value: bytes) -> int: ...
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class StorageType:
2+
FILE: "StorageType"
3+
MEMORY: "StorageType"
4+
5+
class Republish:
6+

python/natsrpy/_internal/jetstream/__init__.pyi

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

python/natsrpy/_internal/jetstream/kv.pyi

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

0 commit comments

Comments
 (0)