tigrbl-ops-realtime 0.1.10.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ Metadata-Version: 2.4
2
+ Name: tigrbl-ops-realtime
3
+ Version: 0.1.10.dev1
4
+ Summary: Realtime, stream, and datagram operation implementations for Tigrbl.
5
+ License-Expression: Apache-2.0
6
+ Keywords: tigrbl,sdk,standards,framework,realtime,stream
7
+ Author: Jacob Stewart
8
+ Author-email: jacob@swarmauri.com
9
+ Requires-Python: >=3.10,<3.14
10
+ Classifier: Development Status :: 1 - Planning
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Description-Content-Type: text/markdown
19
+
20
+ # tigrbl-ops-realtime
21
+
22
+ Builtin realtime, stream, transfer, and datagram verbs for the next-target Tigrbl surface.
23
+ ## Canonical documentation
24
+
25
+ This file is a package-local distribution entry point. Authoritative workspace guidance lives in:
26
+
27
+ - `docs/README.md`
28
+ - `docs/conformance/CURRENT_TARGET.md`
29
+ - `docs/conformance/CURRENT_STATE.md`
30
+ - `docs/conformance/NEXT_STEPS.md`
31
+ - `docs/governance/DOC_POINTERS.md`
32
+ - `docs/developer/PACKAGE_CATALOG.md`
33
+ - `docs/developer/PACKAGE_LAYOUT.md`
34
+
35
+
@@ -0,0 +1,15 @@
1
+ # tigrbl-ops-realtime
2
+
3
+ Builtin realtime, stream, transfer, and datagram verbs for the next-target Tigrbl surface.
4
+ ## Canonical documentation
5
+
6
+ This file is a package-local distribution entry point. Authoritative workspace guidance lives in:
7
+
8
+ - `docs/README.md`
9
+ - `docs/conformance/CURRENT_TARGET.md`
10
+ - `docs/conformance/CURRENT_STATE.md`
11
+ - `docs/conformance/NEXT_STEPS.md`
12
+ - `docs/governance/DOC_POINTERS.md`
13
+ - `docs/developer/PACKAGE_CATALOG.md`
14
+ - `docs/developer/PACKAGE_LAYOUT.md`
15
+
@@ -0,0 +1,35 @@
1
+ [project]
2
+ name = "tigrbl-ops-realtime"
3
+ version = "0.1.10.dev1"
4
+ description = "Realtime, stream, and datagram operation implementations for Tigrbl."
5
+ license = "Apache-2.0"
6
+ readme = "README.md"
7
+ repository = "http://github.com/swarmauri/swarmauri-sdk"
8
+ requires-python = ">=3.10,<3.14"
9
+ classifiers = [
10
+ "Development Status :: 1 - Planning",
11
+ "Programming Language :: Python :: 3.10",
12
+ "Programming Language :: Python :: 3.11",
13
+ "Programming Language :: Python :: 3.12",
14
+ "Programming Language :: Python :: 3.13",
15
+ "Programming Language :: Python",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3 :: Only",
18
+ ]
19
+ authors = [{ name = "Jacob Stewart", email = "jacob@swarmauri.com" }]
20
+ keywords = ["tigrbl", "sdk", "standards", "framework", "realtime", "stream"]
21
+
22
+ [build-system]
23
+ requires = ["poetry-core>=1.0.0"]
24
+ build-backend = "poetry.core.masonry.api"
25
+
26
+ [tool.poetry]
27
+ packages = [
28
+ { include = "tigrbl_ops_realtime" },
29
+ ]
30
+
31
+ [dependency-groups]
32
+ dev = [
33
+ "pytest>=8.0",
34
+ "ruff>=0.9",
35
+ ]
@@ -0,0 +1,23 @@
1
+ """Realtime operation implementations for Tigrbl."""
2
+
3
+ from .ops import (
4
+ append_chunk,
5
+ checkpoint,
6
+ download,
7
+ publish,
8
+ send_datagram,
9
+ subscribe,
10
+ tail,
11
+ upload,
12
+ )
13
+
14
+ __all__ = [
15
+ "publish",
16
+ "subscribe",
17
+ "tail",
18
+ "upload",
19
+ "download",
20
+ "append_chunk",
21
+ "send_datagram",
22
+ "checkpoint",
23
+ ]
@@ -0,0 +1,63 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any, Dict, Mapping
4
+
5
+
6
+ def _body(payload: Any) -> Mapping[str, Any]:
7
+ if not isinstance(payload, Mapping):
8
+ raise TypeError("Realtime operations require mapping payloads")
9
+ return payload
10
+
11
+
12
+ async def publish(payload: Any) -> Dict[str, Any]:
13
+ body = _body(payload)
14
+ channel = str(body.get("channel", "default"))
15
+ event = body.get("event")
16
+ return {"published": True, "channel": channel, "event": event}
17
+
18
+
19
+ async def subscribe(payload: Any) -> Dict[str, Any]:
20
+ body = _body(payload)
21
+ channel = str(body.get("channel", "default"))
22
+ cursor = body.get("cursor")
23
+ return {"subscribed": True, "channel": channel, "cursor": cursor}
24
+
25
+
26
+ async def tail(payload: Any) -> Dict[str, Any]:
27
+ body = _body(payload)
28
+ stream = str(body.get("stream", body.get("channel", "default")))
29
+ limit = int(body.get("limit", 50))
30
+ return {"stream": stream, "limit": limit, "tailed": True}
31
+
32
+
33
+ async def upload(payload: Any) -> Dict[str, Any]:
34
+ body = _body(payload)
35
+ name = str(body.get("name", "blob"))
36
+ size = len(body.get("content", b"")) if isinstance(body.get("content"), (bytes, bytearray)) else body.get("size")
37
+ return {"uploaded": True, "name": name, "size": size}
38
+
39
+
40
+ async def download(payload: Any) -> Dict[str, Any]:
41
+ body = _body(payload)
42
+ name = str(body.get("name", "blob"))
43
+ return {"downloaded": True, "name": name, "checkpoint": body.get("checkpoint")}
44
+
45
+
46
+ async def append_chunk(payload: Any) -> Dict[str, Any]:
47
+ body = _body(payload)
48
+ stream = str(body.get("stream", "default"))
49
+ chunk = body.get("chunk", b"")
50
+ size = len(chunk) if isinstance(chunk, (bytes, bytearray, str)) else None
51
+ return {"appended": True, "stream": stream, "size": size}
52
+
53
+
54
+ async def send_datagram(payload: Any) -> Dict[str, Any]:
55
+ body = _body(payload)
56
+ route = str(body.get("route", body.get("channel", "default")))
57
+ return {"sent": True, "route": route, "ttl": body.get("ttl")}
58
+
59
+
60
+ async def checkpoint(payload: Any) -> Dict[str, Any]:
61
+ body = _body(payload)
62
+ cursor = body.get("cursor") or body.get("offset") or body.get("sequence")
63
+ return {"checkpointed": True, "cursor": cursor}