koi-net 1.0.0b7__tar.gz → 1.0.0b8__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.
Potentially problematic release.
This version of koi-net might be problematic. Click here for more details.
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/PKG-INFO +4 -5
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/README.md +3 -4
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/examples/basic_coordinator_node.py +2 -2
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/examples/full_node_template.py +2 -2
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/pyproject.toml +1 -1
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/network/interface.py +2 -2
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/network/response_handler.py +1 -1
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/api_models.py +1 -1
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/.gitignore +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/LICENSE +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/examples/basic_partial_node.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/examples/partial_node_template.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/requirements.txt +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/__init__.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/core.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/identity.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/network/__init__.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/network/graph.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/network/request_handler.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/processor/__init__.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/processor/default_handlers.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/processor/handler.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/processor/interface.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/processor/knowledge_object.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/__init__.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/consts.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/edge.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/event.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/helpers.py +0 -0
- {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/node.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: koi-net
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0b8
|
|
4
4
|
Summary: Implementation of KOI-net protocol in Python
|
|
5
5
|
Project-URL: Homepage, https://github.com/BlockScience/koi-net/
|
|
6
6
|
Author-email: Luke Miller <luke@block.science>
|
|
@@ -144,7 +144,8 @@ node = NodeInterface(
|
|
|
144
144
|
event=[],
|
|
145
145
|
state=[]
|
|
146
146
|
)
|
|
147
|
-
)
|
|
147
|
+
),
|
|
148
|
+
use_kobj_processor_thread=True
|
|
148
149
|
)
|
|
149
150
|
```
|
|
150
151
|
|
|
@@ -196,11 +197,9 @@ from koi_net.protocol.api_models import *
|
|
|
196
197
|
from koi_net.protocol.consts import *
|
|
197
198
|
|
|
198
199
|
@app.post(BROADCAST_EVENTS_PATH)
|
|
199
|
-
def broadcast_events(req: EventsPayload
|
|
200
|
+
def broadcast_events(req: EventsPayload):
|
|
200
201
|
for event in req.events:
|
|
201
202
|
node.processor.handle(event=event, source=KnowledgeSource.External)
|
|
202
|
-
|
|
203
|
-
background.add_task(node.processor.flush_kobj_queue)
|
|
204
203
|
```
|
|
205
204
|
|
|
206
205
|
Next we can add the event polling endpoint, this allows partial nodes to receive events from us.
|
|
@@ -102,7 +102,8 @@ node = NodeInterface(
|
|
|
102
102
|
event=[],
|
|
103
103
|
state=[]
|
|
104
104
|
)
|
|
105
|
-
)
|
|
105
|
+
),
|
|
106
|
+
use_kobj_processor_thread=True
|
|
106
107
|
)
|
|
107
108
|
```
|
|
108
109
|
|
|
@@ -154,11 +155,9 @@ from koi_net.protocol.api_models import *
|
|
|
154
155
|
from koi_net.protocol.consts import *
|
|
155
156
|
|
|
156
157
|
@app.post(BROADCAST_EVENTS_PATH)
|
|
157
|
-
def broadcast_events(req: EventsPayload
|
|
158
|
+
def broadcast_events(req: EventsPayload):
|
|
158
159
|
for event in req.events:
|
|
159
160
|
node.processor.handle(event=event, source=KnowledgeSource.External)
|
|
160
|
-
|
|
161
|
-
background.add_task(node.processor.flush_kobj_queue)
|
|
162
161
|
```
|
|
163
162
|
|
|
164
163
|
Next we can add the event polling endpoint, this allows partial nodes to receive events from us.
|
|
@@ -3,7 +3,7 @@ import logging
|
|
|
3
3
|
import uvicorn
|
|
4
4
|
from contextlib import asynccontextmanager
|
|
5
5
|
from rich.logging import RichHandler
|
|
6
|
-
from fastapi import FastAPI
|
|
6
|
+
from fastapi import FastAPI
|
|
7
7
|
from rid_lib.types import KoiNetNode, KoiNetEdge
|
|
8
8
|
from koi_net import NodeInterface
|
|
9
9
|
from koi_net.processor.handler import HandlerType
|
|
@@ -103,7 +103,7 @@ app = FastAPI(
|
|
|
103
103
|
)
|
|
104
104
|
|
|
105
105
|
@app.post(BROADCAST_EVENTS_PATH)
|
|
106
|
-
def broadcast_events(req: EventsPayload
|
|
106
|
+
def broadcast_events(req: EventsPayload):
|
|
107
107
|
logger.info(f"Request to {BROADCAST_EVENTS_PATH}, received {len(req.events)} event(s)")
|
|
108
108
|
for event in req.events:
|
|
109
109
|
node.processor.handle(event=event, source=KnowledgeSource.External)
|
|
@@ -2,7 +2,7 @@ import logging
|
|
|
2
2
|
import uvicorn
|
|
3
3
|
from contextlib import asynccontextmanager
|
|
4
4
|
from rich.logging import RichHandler
|
|
5
|
-
from fastapi import FastAPI
|
|
5
|
+
from fastapi import FastAPI
|
|
6
6
|
from rid_lib.types import KoiNetNode, KoiNetEdge
|
|
7
7
|
from koi_net import NodeInterface
|
|
8
8
|
from koi_net.processor.knowledge_object import KnowledgeSource
|
|
@@ -65,7 +65,7 @@ async def lifespan(app: FastAPI):
|
|
|
65
65
|
app = FastAPI(lifespan=lifespan, root_path="/koi-net")
|
|
66
66
|
|
|
67
67
|
@app.post(BROADCAST_EVENTS_PATH)
|
|
68
|
-
def broadcast_events(req: EventsPayload
|
|
68
|
+
def broadcast_events(req: EventsPayload):
|
|
69
69
|
logger.info(f"Request to {BROADCAST_EVENTS_PATH}, received {len(req.events)} event(s)")
|
|
70
70
|
for event in req.events:
|
|
71
71
|
node.processor.handle(event=event, source=KnowledgeSource.External)
|
|
@@ -201,8 +201,8 @@ class NetworkInterface:
|
|
|
201
201
|
payload = self.request_handler.fetch_bundles(
|
|
202
202
|
node=node_rid, rids=[rid])
|
|
203
203
|
|
|
204
|
-
if payload.
|
|
205
|
-
remote_bundle = payload.
|
|
204
|
+
if payload.bundles:
|
|
205
|
+
remote_bundle = payload.bundles[0]
|
|
206
206
|
logger.info(f"Got bundle from '{node_rid}'")
|
|
207
207
|
break
|
|
208
208
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|