koi-net 1.0.0b10__py3-none-any.whl → 1.0.0b11__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.

Potentially problematic release.


This version of koi-net might be problematic. Click here for more details.

koi_net/core.py CHANGED
@@ -50,7 +50,7 @@ class NodeInterface:
50
50
  )
51
51
 
52
52
  # pull all handlers defined in default_handlers module
53
- if not handlers:
53
+ if handlers is None:
54
54
  handlers = [
55
55
  obj for obj in vars(default_handlers).values()
56
56
  if isinstance(obj, KnowledgeHandler)
@@ -171,10 +171,12 @@ class NetworkInterface:
171
171
 
172
172
  try:
173
173
  self.request_handler.broadcast_events(node, events=events)
174
+ return True
174
175
  except httpx.ConnectError:
175
- logger.warning("Broadcast failed, requeuing events")
176
+ logger.warning("Broadcast failed, dropping node")
176
177
  for event in events:
177
178
  self.push_event_to(event, node)
179
+ return False
178
180
 
179
181
  def get_state_providers(self, rid_type: RIDType) -> list[KoiNetNode]:
180
182
  """Returns list of node RIDs which provide state for the specified RID type."""
@@ -186,13 +186,13 @@ class ProcessorInterface:
186
186
  logger.debug("Attempting to read bundle from cache")
187
187
  bundle = self.cache.read(kobj.rid)
188
188
 
189
- if kobj.manifest != bundle.manifest:
190
- logger.warning("Retrieved bundle contains a different manifest")
191
-
192
189
  if not bundle:
193
190
  logger.debug("Failed to find bundle")
194
191
  return
195
192
 
193
+ if kobj.manifest != bundle.manifest:
194
+ logger.warning("Retrieved bundle contains a different manifest")
195
+
196
196
  kobj.manifest = bundle.manifest
197
197
  kobj.contents = bundle.contents
198
198
 
@@ -224,7 +224,10 @@ class ProcessorInterface:
224
224
  logger.debug("No network targets set")
225
225
 
226
226
  for node in kobj.network_targets:
227
- self.network.push_event_to(kobj.normalized_event, node, flush=True)
227
+ self.network.push_event_to(kobj.normalized_event, node)
228
+ if not self.network.flush_webhook_queue(node):
229
+ logger.warning("Dropping unresponsive node")
230
+ self.handle(rid=node, event_type=EventType.FORGET)
228
231
 
229
232
  kobj = self.call_handler_chain(HandlerType.Final, kobj)
230
233
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: koi-net
3
- Version: 1.0.0b10
3
+ Version: 1.0.0b11
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>
@@ -118,7 +118,9 @@ The request and payload JSON objects are composed of the fundamental "knowledge
118
118
  }
119
119
  ```
120
120
 
121
- This means that events are essentially just an RID, manifest, or bundle with an event type attached. Event types can be one of `"FORGET"`, `"UPDATE"`, or `"NEW"` forming the "FUN" acronym. While these types roughly correspond to delete, update, and create from CRUD operations, but they are not commands, they are signals. A node emits an event to indicate that its internal state has changed:
121
+ An event is a signalling construct that conveys information about RID objects between networked nodes. Events are composed of an RID, manifest, or bundle with an event type attached. Event types can be one of `"FORGET"`, `"UPDATE"`, or `"NEW"` forming the "FUN" acronym.
122
+
123
+ As opposed to CRUD (create, read, update, delete), events are a series of messages, not operations. Each node has its own autonomy in deciding how to react based on the message it receives. For example, a processor node may receive a `"NEW"` event for an RID object its not interested in, and ignore it. Or it may decide that an `"UPDATE"` event should trigger fetching a bundle from another node. A node emits an event to indicate that its internal state has changed:
122
124
  - `"NEW"` - indicates an previously unknown RID was cached
123
125
  - `"UPDATE"` - indicates a previously known RID was cached
124
126
  - `"FORGET"` - indicates a previously known RID was deleted
@@ -1,15 +1,15 @@
1
1
  koi_net/__init__.py,sha256=b0Ze0pZmJAuygpWUFHM6Kvqo3DkU_uzmkptv1EpAArw,31
2
- koi_net/core.py,sha256=9Paw7GTf3JeE8X73fGgi9K2uoT2A20Ft4m_gA9xAepI,4683
2
+ koi_net/core.py,sha256=975g-IcEQ72wZCulg34Orh7vJNRWMCh5iC5kppz_18Q,4687
3
3
  koi_net/identity.py,sha256=PBgmAx5f3zzQmHASB1TJW2g19n9TLfmSJMXg2eQFg0A,2386
4
4
  koi_net/network/__init__.py,sha256=r_RN-q_mDYC-2RAkN-lJoMUX76TXyfEUc_MVKW87z0g,39
5
5
  koi_net/network/graph.py,sha256=KyS4Vv94DhHQk12u6rmE8nOIuTxeoJjrnoYEwVMNM74,4837
6
- koi_net/network/interface.py,sha256=8zO2qBYmyd-MyAX-8RAf1mjL_0fn08-IbVOKHCAwNf8,10660
6
+ koi_net/network/interface.py,sha256=ogVnVufGPv_x83KnGf3AwhCBTF8xETBH3QId6oqpyNs,10708
7
7
  koi_net/network/request_handler.py,sha256=dufyJRwKD5w578UM-wzFVT3EU78NMvrh_yNSiI7vgfw,4938
8
8
  koi_net/network/response_handler.py,sha256=HaP8Fl0bp_lfMmevhdVY8s9o0Uf8CR1ZaW5g3jsX8gw,1888
9
9
  koi_net/processor/__init__.py,sha256=x4fAY0hvQEDcpfdTB3POIzxBQjYAtn0qQazPo1Xm0m4,41
10
10
  koi_net/processor/default_handlers.py,sha256=ebFJ_MqvGBAb0SxmreZ9Pvyi0tD7ygDvJKECglw8uAQ,6972
11
11
  koi_net/processor/handler.py,sha256=a2wxG3kgux-07YP13HSj_PH5VH_PjbnTS4uZEHjxMw0,2582
12
- koi_net/processor/interface.py,sha256=8DT7-FFWj2vh-DXtuI9NXicOTSozaMSDTziMC2RMwuQ,13010
12
+ koi_net/processor/interface.py,sha256=IH3rh2lAliqNSKsuH8PwY9N098SnVUBy3Ccel8YgiRM,13188
13
13
  koi_net/processor/knowledge_object.py,sha256=xI1K4lIGJrWbb7yStjpU4eqZGI7t4wFklv72V7TRfXY,4212
14
14
  koi_net/protocol/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  koi_net/protocol/api_models.py,sha256=RDwVHAahiWzwzUnlj5MIm9et5WVpQOaG-Uscv1B9coU,1116
@@ -18,7 +18,7 @@ koi_net/protocol/edge.py,sha256=G3D9Ie0vbTSMJdoTw9g_oBmFCqzJ1gO7U1PVrw7p3j8,447
18
18
  koi_net/protocol/event.py,sha256=YHsLD9HPwib-HiCWv9ep0sPqL2VHQqx_egDmbriChXM,1378
19
19
  koi_net/protocol/helpers.py,sha256=9E9PaoIuSNrTBATGCLJ_kSBMZ2z-KIMnLJzGOTqQDC0,719
20
20
  koi_net/protocol/node.py,sha256=Ntrx01dbm39ViKGtr4gLmztcMwKpTIweS6rRL-zoU_Y,391
21
- koi_net-1.0.0b10.dist-info/METADATA,sha256=eQtnFOOH0wpuPMaASpOJJieHhEUadPvVcZ7XdQw0Jh8,33783
22
- koi_net-1.0.0b10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
- koi_net-1.0.0b10.dist-info/licenses/LICENSE,sha256=XBcvl8yjCAezfuqN1jadQykrX7H2g4nr2WRDmHLW6ik,1090
24
- koi_net-1.0.0b10.dist-info/RECORD,,
21
+ koi_net-1.0.0b11.dist-info/METADATA,sha256=CAQb9AH_yDb2FO1XT9FzmDrrfUsCYTDUUo3mCPq8VQ4,34131
22
+ koi_net-1.0.0b11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ koi_net-1.0.0b11.dist-info/licenses/LICENSE,sha256=XBcvl8yjCAezfuqN1jadQykrX7H2g4nr2WRDmHLW6ik,1090
24
+ koi_net-1.0.0b11.dist-info/RECORD,,