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.

Files changed (30) hide show
  1. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/PKG-INFO +4 -5
  2. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/README.md +3 -4
  3. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/examples/basic_coordinator_node.py +2 -2
  4. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/examples/full_node_template.py +2 -2
  5. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/pyproject.toml +1 -1
  6. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/network/interface.py +2 -2
  7. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/network/response_handler.py +1 -1
  8. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/api_models.py +1 -1
  9. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/.gitignore +0 -0
  10. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/LICENSE +0 -0
  11. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/examples/basic_partial_node.py +0 -0
  12. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/examples/partial_node_template.py +0 -0
  13. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/requirements.txt +0 -0
  14. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/__init__.py +0 -0
  15. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/core.py +0 -0
  16. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/identity.py +0 -0
  17. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/network/__init__.py +0 -0
  18. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/network/graph.py +0 -0
  19. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/network/request_handler.py +0 -0
  20. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/processor/__init__.py +0 -0
  21. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/processor/default_handlers.py +0 -0
  22. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/processor/handler.py +0 -0
  23. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/processor/interface.py +0 -0
  24. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/processor/knowledge_object.py +0 -0
  25. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/__init__.py +0 -0
  26. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/consts.py +0 -0
  27. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/edge.py +0 -0
  28. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/event.py +0 -0
  29. {koi_net-1.0.0b7 → koi_net-1.0.0b8}/src/koi_net/protocol/helpers.py +0 -0
  30. {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.0b7
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, background: BackgroundTasks):
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, background: BackgroundTasks):
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, BackgroundTasks
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, background: BackgroundTasks):
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, BackgroundTasks
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, background: BackgroundTasks):
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)
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "koi-net"
7
- version = "1.0.0-beta.7"
7
+ version = "1.0.0-beta.8"
8
8
  description = "Implementation of KOI-net protocol in Python"
9
9
  authors = [
10
10
  {name = "Luke Miller", email = "luke@block.science"}
@@ -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.manifests:
205
- remote_bundle = payload.manifests[0]
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
 
@@ -56,4 +56,4 @@ class ResponseHandler:
56
56
  else:
57
57
  not_found.append(rid)
58
58
 
59
- return BundlesPayload(manifests=bundles, not_found=not_found)
59
+ return BundlesPayload(bundles=bundles, not_found=not_found)
@@ -33,7 +33,7 @@ class ManifestsPayload(BaseModel):
33
33
  not_found: list[RID] = []
34
34
 
35
35
  class BundlesPayload(BaseModel):
36
- manifests: list[Bundle]
36
+ bundles: list[Bundle]
37
37
  not_found: list[RID] = []
38
38
  deferred: list[RID] = []
39
39
 
File without changes
File without changes
File without changes
File without changes