brain-db-sdk 0.1.0__py3-none-any.whl
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.
- brain_db_sdk/__init__.py +87 -0
- brain_db_sdk/client.py +1101 -0
- brain_db_sdk/errors.py +117 -0
- brain_db_sdk/http/__init__.py +106 -0
- brain_db_sdk/http/client.py +600 -0
- brain_db_sdk/http/errors.py +25 -0
- brain_db_sdk/http/retry.py +54 -0
- brain_db_sdk/http/types.py +828 -0
- brain_db_sdk/mux.py +401 -0
- brain_db_sdk/pool.py +152 -0
- brain_db_sdk/py.typed +0 -0
- brain_db_sdk/retry.py +111 -0
- brain_db_sdk/transport.py +57 -0
- brain_db_sdk/verbs.py +263 -0
- brain_db_sdk/wire/__init__.py +65 -0
- brain_db_sdk/wire/cbor.py +300 -0
- brain_db_sdk/wire/crc32c.py +42 -0
- brain_db_sdk/wire/frame.py +191 -0
- brain_db_sdk/wire/opcode.py +183 -0
- brain_db_sdk/wire/types.py +7095 -0
- brain_db_sdk-0.1.0.dist-info/METADATA +119 -0
- brain_db_sdk-0.1.0.dist-info/RECORD +24 -0
- brain_db_sdk-0.1.0.dist-info/WHEEL +4 -0
- brain_db_sdk-0.1.0.dist-info/licenses/LICENSE +201 -0
brain_db_sdk/__init__.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""brain-db-sdk — Python client for the Brain memory database.
|
|
2
|
+
|
|
3
|
+
Brain ships no client library; its contract is the wire protocol (a
|
|
4
|
+
32-byte ``BRN0`` frame header + CBOR payloads over TCP). This package
|
|
5
|
+
re-implements that protocol independently — the spec, not a shared
|
|
6
|
+
library, is the source of truth — and is verified byte-for-byte against
|
|
7
|
+
Brain's conformance corpus.
|
|
8
|
+
|
|
9
|
+
Status: the wire codec (L1 frame + L2 CBOR payload + typed payloads) is
|
|
10
|
+
corpus-verified, and on top of it a synchronous connection layer —
|
|
11
|
+
transport, handshake, a multiplexed :class:`MuxConnection`, a high-level
|
|
12
|
+
:class:`BrainClient` serving the full v1 + typed-graph verb surface
|
|
13
|
+
(encode, recall, forget, link, the entity / statement / relation / schema
|
|
14
|
+
graph ops, transactions, and subscriptions), a connection
|
|
15
|
+
:class:`Pool`, and a retry helper.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
__version__ = "0.1.0"
|
|
21
|
+
|
|
22
|
+
# HTTP tier — the hosted-edge client (talks to `brain-edge` / the Arc gateway).
|
|
23
|
+
from . import (
|
|
24
|
+
http,
|
|
25
|
+
wire,
|
|
26
|
+
)
|
|
27
|
+
from .client import (
|
|
28
|
+
Auth,
|
|
29
|
+
BrainClient,
|
|
30
|
+
ClientConfig,
|
|
31
|
+
ConnectionInfo,
|
|
32
|
+
derive_space_id,
|
|
33
|
+
new_id,
|
|
34
|
+
)
|
|
35
|
+
from .errors import (
|
|
36
|
+
ActAsDenied,
|
|
37
|
+
BrainError,
|
|
38
|
+
BrainTimeout,
|
|
39
|
+
ConnectionClosed,
|
|
40
|
+
ProtocolError,
|
|
41
|
+
ServerError,
|
|
42
|
+
VersionMismatch,
|
|
43
|
+
is_retryable,
|
|
44
|
+
)
|
|
45
|
+
from .http import BrainHttpClient, BrainHttpError
|
|
46
|
+
from .mux import HandshakeOutcome, MuxConnection, Subscription
|
|
47
|
+
from .pool import Pool
|
|
48
|
+
from .retry import RetryPolicy, with_retry
|
|
49
|
+
from .verbs import EncodeBuilder, ForgetBuilder, RecallBuilder
|
|
50
|
+
from .wire.types import AnswerKind, RecallAnswer, RecallScope, WaitMode
|
|
51
|
+
|
|
52
|
+
__all__ = [
|
|
53
|
+
"wire",
|
|
54
|
+
# The HTTP tier was imported here for re-export but never listed, so
|
|
55
|
+
# `from brain_db_sdk import *` did not carry it and strict type checkers
|
|
56
|
+
# treated it as a private re-export for downstream users.
|
|
57
|
+
"http",
|
|
58
|
+
"BrainHttpClient",
|
|
59
|
+
"BrainHttpError",
|
|
60
|
+
"BrainClient",
|
|
61
|
+
"ClientConfig",
|
|
62
|
+
"ConnectionInfo",
|
|
63
|
+
"Auth",
|
|
64
|
+
"new_id",
|
|
65
|
+
"derive_space_id",
|
|
66
|
+
"HandshakeOutcome",
|
|
67
|
+
"MuxConnection",
|
|
68
|
+
"Subscription",
|
|
69
|
+
"Pool",
|
|
70
|
+
"EncodeBuilder",
|
|
71
|
+
"RecallBuilder",
|
|
72
|
+
"ForgetBuilder",
|
|
73
|
+
"RecallAnswer",
|
|
74
|
+
"AnswerKind",
|
|
75
|
+
"RecallScope",
|
|
76
|
+
"WaitMode",
|
|
77
|
+
"RetryPolicy",
|
|
78
|
+
"with_retry",
|
|
79
|
+
"BrainError",
|
|
80
|
+
"ProtocolError",
|
|
81
|
+
"ConnectionClosed",
|
|
82
|
+
"BrainTimeout",
|
|
83
|
+
"VersionMismatch",
|
|
84
|
+
"ServerError",
|
|
85
|
+
"ActAsDenied",
|
|
86
|
+
"is_retryable",
|
|
87
|
+
]
|