Renaming Bubble folder, some docs updates
This commit is contained in:
parent
be2156afe0
commit
68ebf88e6e
|
@ -1,4 +1,4 @@
|
||||||
bin
|
bin/
|
||||||
lib*
|
lib*
|
||||||
share/
|
share/
|
||||||
**/__pycache__/
|
**/__pycache__/
|
||||||
|
@ -7,4 +7,4 @@ src/webui/htmx-extensions/
|
||||||
src/webui/res/js/node_modules/
|
src/webui/res/js/node_modules/
|
||||||
src/daisy/
|
src/daisy/
|
||||||
src/catch/
|
src/catch/
|
||||||
src/logs
|
src/logs/
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Network map representation
|
|
||||||
|
|
||||||
### *class* Bubble.map.Network(icg=None, file=None)
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Data routing logic and data
|
|
||||||
|
|
||||||
### *class* Bubble.router.Router(cLog, nfpath='server.info')
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
# Network map representation
|
||||||
|
|
||||||
|
### *class* Siph.map.Network(file=None)
|
||||||
|
|
||||||
|
Layered graph network
|
||||||
|
|
||||||
|
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/src/Bubble/map.py)
|
||||||
|
|
||||||
|
#### omap
|
||||||
|
|
||||||
|
The outer network map of nodes
|
||||||
|
|
||||||
|
* **Type:**
|
||||||
|
nx.Graph
|
||||||
|
|
||||||
|
#### imap
|
||||||
|
|
||||||
|
The inner network map of peers
|
||||||
|
|
||||||
|
* **Type:**
|
||||||
|
nx.Graph
|
||||||
|
|
||||||
|
#### emaps
|
||||||
|
|
||||||
|
Extra network maps (TODO)
|
||||||
|
|
||||||
|
* **Type:**
|
||||||
|
list[nx.Graph]
|
||||||
|
|
||||||
|
#### lookup
|
||||||
|
|
||||||
|
Map of PierMesh node IDs to MeshTastic node IDs
|
||||||
|
|
||||||
|
* **Type:**
|
||||||
|
dict
|
||||||
|
|
||||||
|
#### addLookup(onodeID: str, mnodeID: str)
|
||||||
|
|
||||||
|
Adds node to lookup
|
||||||
|
|
||||||
|
* **Parameters:**
|
||||||
|
* **onodeID** (*str*) – Internal nodeID
|
||||||
|
* **mnodeID** (*str*) – MeshTastic nodeID
|
||||||
|
|
||||||
|
#### addie(nodea: int, nodeb: int)
|
||||||
|
|
||||||
|
Add edge between peers on inner map
|
||||||
|
|
||||||
|
#### addin(id: int)
|
||||||
|
|
||||||
|
Add peer on inner map
|
||||||
|
|
||||||
|
#### id
|
||||||
|
|
||||||
|
PierMesh node ID
|
||||||
|
|
||||||
|
* **Type:**
|
||||||
|
int
|
||||||
|
|
||||||
|
#### addoe(nodea: int, nodeb: int)
|
||||||
|
|
||||||
|
Add edge between nodes on outer map
|
||||||
|
|
||||||
|
#### addon(id: int)
|
||||||
|
|
||||||
|
Add node on outer map
|
||||||
|
|
||||||
|
#### id
|
||||||
|
|
||||||
|
PierMesh node ID
|
||||||
|
|
||||||
|
* **Type:**
|
||||||
|
int
|
||||||
|
|
||||||
|
#### doLookup(onodeID: str)
|
||||||
|
|
||||||
|
Get MeshTastic ID from PierMesh ID
|
||||||
|
|
||||||
|
#### export(path: str)
|
||||||
|
|
||||||
|
Export network map to binary file (msgpack encoded)
|
||||||
|
|
||||||
|
#### path
|
||||||
|
|
||||||
|
File output path
|
||||||
|
|
||||||
|
* **Type:**
|
||||||
|
str
|
||||||
|
|
||||||
|
#### getRoute(senderNode: int, recipientNode: int)
|
||||||
|
|
||||||
|
Get the shortest route between two nodes on the outer map (Needs checkup)
|
||||||
|
|
||||||
|
#### mimport(path: str)
|
||||||
|
|
||||||
|
Import map from path
|
||||||
|
|
||||||
|
#### render(pathPrefix: str = '')
|
||||||
|
|
||||||
|
Render outer and inner network mao to disk at the given path prefix
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Data routing logic and data
|
||||||
|
|
||||||
|
### *class* Siph.router.Router(cLog, nfpath='server.info')
|
|
@ -31,11 +31,28 @@ sphinx-quickstart on Fri Jul 26 23:30:55 2024. -->
|
||||||
* [`TUI.do_set_mem()`](/PierMesh/piermesh/src/branch/main/docs/ui.md#ui.TUI.do_set_mem)
|
* [`TUI.do_set_mem()`](/PierMesh/piermesh/src/branch/main/docs/ui.md#ui.TUI.do_set_mem)
|
||||||
* [`TUI.do_write_line()`](/PierMesh/piermesh/src/branch/main/docs/ui.md#ui.TUI.do_write_line)
|
* [`TUI.do_write_line()`](/PierMesh/piermesh/src/branch/main/docs/ui.md#ui.TUI.do_write_line)
|
||||||
* [`TUI.on_mount()`](/PierMesh/piermesh/src/branch/main/docs/ui.md#ui.TUI.on_mount)
|
* [`TUI.on_mount()`](/PierMesh/piermesh/src/branch/main/docs/ui.md#ui.TUI.on_mount)
|
||||||
* [Configuration utilities](/PierMesh/piermesh/src/branch/main/docs/Bubble/config.md)
|
* [Configuration utilities](/PierMesh/piermesh/src/branch/main/docs/Siph/config.md)
|
||||||
* [Network map representation](/PierMesh/piermesh/src/branch/main/docs/Bubble/map.md)
|
* [Network map representation](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md)
|
||||||
* [`Network`](/PierMesh/piermesh/src/branch/main/docs/Bubble/map.md#Bubble.map.Network)
|
* [`Network`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network)
|
||||||
* [Data routing logic and data](/PierMesh/piermesh/src/branch/main/docs/Bubble/router.md)
|
* [`Network.omap`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.omap)
|
||||||
* [`Router`](/PierMesh/piermesh/src/branch/main/docs/Bubble/router.md#Bubble.router.Router)
|
* [`Network.imap`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.imap)
|
||||||
|
* [`Network.emaps`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.emaps)
|
||||||
|
* [`Network.lookup`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.lookup)
|
||||||
|
* [`Network.addLookup()`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.addLookup)
|
||||||
|
* [`Network.addie()`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.addie)
|
||||||
|
* [`Network.addin()`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.addin)
|
||||||
|
* [`Network.id`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.id)
|
||||||
|
* [`Network.addoe()`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.addoe)
|
||||||
|
* [`Network.addon()`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.addon)
|
||||||
|
* [`Network.id`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#id0)
|
||||||
|
* [`Network.doLookup()`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.doLookup)
|
||||||
|
* [`Network.export()`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.export)
|
||||||
|
* [`Network.path`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.path)
|
||||||
|
* [`Network.getRoute()`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.getRoute)
|
||||||
|
* [`Network.mimport()`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.mimport)
|
||||||
|
* [`Network.render()`](/PierMesh/piermesh/src/branch/main/docs/Siph/map.md#Siph.map.Network.render)
|
||||||
|
* [Data routing logic and data](/PierMesh/piermesh/src/branch/main/docs/Siph/router.md)
|
||||||
|
* [`Router`](/PierMesh/piermesh/src/branch/main/docs/Siph/router.md#Siph.router.Router)
|
||||||
* [Schemaless binary database](/PierMesh/piermesh/src/branch/main/docs/Components/daisy.md)
|
* [Schemaless binary database](/PierMesh/piermesh/src/branch/main/docs/Components/daisy.md)
|
||||||
* [`Daisy`](/PierMesh/piermesh/src/branch/main/docs/Components/daisy.md#Components.daisy.Daisy)
|
* [`Daisy`](/PierMesh/piermesh/src/branch/main/docs/Components/daisy.md#Components.daisy.Daisy)
|
||||||
* [`Daisy.get()`](/PierMesh/piermesh/src/branch/main/docs/Components/daisy.md#Components.daisy.Daisy.get)
|
* [`Daisy.get()`](/PierMesh/piermesh/src/branch/main/docs/Components/daisy.md#Components.daisy.Daisy.get)
|
||||||
|
|
|
@ -33,7 +33,7 @@ Map new network data to internal network map
|
||||||
Get catch and return the data to a peer
|
Get catch and return the data to a peer
|
||||||
|
|
||||||
#### SEE ALSO
|
#### SEE ALSO
|
||||||
[`Bubble.router.Router`](/PierMesh/piermesh/src/branch/main/docs/Bubble/router.md#Bubble.router.Router)
|
`Bubble.router.Router`
|
||||||
: Routing class
|
: Routing class
|
||||||
|
|
||||||
#### *async* action_sendToPeer(data: dict)
|
#### *async* action_sendToPeer(data: dict)
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
import networkx as nx
|
|
||||||
import msgpack
|
|
||||||
import json
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
|
|
||||||
# TODO: Extra maps logic
|
|
||||||
|
|
||||||
|
|
||||||
class Network:
|
|
||||||
"""
|
|
||||||
Layered graph network
|
|
||||||
|
|
||||||
`🔗 Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/src/Bubble/map.py>`_
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, icg=None, file=None):
|
|
||||||
self.omap = nx.Graph()
|
|
||||||
self.imap = nx.Graph()
|
|
||||||
self.emaps = []
|
|
||||||
self.lookup = {}
|
|
||||||
|
|
||||||
def addLookup(self, onodeID, mnodeID):
|
|
||||||
self.lookup[onodeID] = mnodeID
|
|
||||||
|
|
||||||
def doLookup(self, onodeID):
|
|
||||||
if onodeID in self.lookup.keys():
|
|
||||||
return self.lookup[onodeID]
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def export(self, path):
|
|
||||||
n = {}
|
|
||||||
n["omap"] = nx.to_dict_of_dicts(self.omap)
|
|
||||||
n["imap"] = nx.to_dict_of_dicts(self.imap)
|
|
||||||
n["emaps"] = []
|
|
||||||
for e in self.emaps:
|
|
||||||
n["emaps"].append(nx.to_dict_of_dicts(e))
|
|
||||||
# TODO: Daisy
|
|
||||||
with open(path, "wb") as f:
|
|
||||||
f.write(msgpack.dumps(n))
|
|
||||||
with open(path + ".json", "w") as f:
|
|
||||||
f.write(json.dumps(n))
|
|
||||||
|
|
||||||
def mimport(self, path):
|
|
||||||
ndata = ""
|
|
||||||
with open(path, "rb") as f:
|
|
||||||
ndata = msgpack.loads(f.read())
|
|
||||||
self.omap = nx.Graph(ndata["omap"])
|
|
||||||
self.imap = nx.Graph(ndata["imap"])
|
|
||||||
self.emaps = []
|
|
||||||
for e in ndata["emaps"]:
|
|
||||||
self.emaps.append(nx.Graph(e))
|
|
||||||
|
|
||||||
def addon(self, id):
|
|
||||||
self.omap.add_node(id)
|
|
||||||
|
|
||||||
def addoe(self, nodea, nodeb):
|
|
||||||
self.omap.add_edge(nodea, nodeb)
|
|
||||||
|
|
||||||
def addin(self, id):
|
|
||||||
self.imap.add_node(id)
|
|
||||||
|
|
||||||
def addie(self, nodea, nodeb):
|
|
||||||
self.imap.add_edge(nodea, nodeb)
|
|
||||||
|
|
||||||
def getRoute(self, senderNode, recipientNode):
|
|
||||||
return nx.shortest_path(self.omap, senderNode, recipientNode)
|
|
||||||
|
|
||||||
def render(self):
|
|
||||||
nx.draw(self.omap)
|
|
||||||
plt.savefig("tmp/omap.png")
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
import networkx as nx
|
||||||
|
import msgpack
|
||||||
|
import json
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
# TODO: Extra maps logic
|
||||||
|
|
||||||
|
|
||||||
|
class Network:
|
||||||
|
"""
|
||||||
|
Layered graph network
|
||||||
|
|
||||||
|
`🔗 Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/src/Bubble/map.py>`_
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
omap: nx.Graph
|
||||||
|
The outer network map of nodes
|
||||||
|
imap: nx.Graph
|
||||||
|
The inner network map of peers
|
||||||
|
emaps: list[nx.Graph]
|
||||||
|
Extra network maps (TODO)
|
||||||
|
lookup: dict
|
||||||
|
Map of PierMesh node IDs to MeshTastic node IDs
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, file=None):
|
||||||
|
"""
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
file:
|
||||||
|
If set, load network file
|
||||||
|
"""
|
||||||
|
if file == None:
|
||||||
|
self.omap = nx.Graph()
|
||||||
|
self.imap = nx.Graph()
|
||||||
|
self.emaps = []
|
||||||
|
else:
|
||||||
|
self.mimport()
|
||||||
|
self.lookup = {}
|
||||||
|
|
||||||
|
def addLookup(self, onodeID: str, mnodeID: str):
|
||||||
|
"""
|
||||||
|
Adds node to lookup
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
onodeID: str
|
||||||
|
Internal nodeID
|
||||||
|
mnodeID: str
|
||||||
|
MeshTastic nodeID
|
||||||
|
"""
|
||||||
|
self.lookup[onodeID] = mnodeID
|
||||||
|
|
||||||
|
def doLookup(self, onodeID: str):
|
||||||
|
"""
|
||||||
|
Get MeshTastic ID from PierMesh ID
|
||||||
|
"""
|
||||||
|
if onodeID in self.lookup.keys():
|
||||||
|
return self.lookup[onodeID]
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def export(self, path: str):
|
||||||
|
"""
|
||||||
|
Export network map to binary file (msgpack encoded)
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
path: str
|
||||||
|
File output path
|
||||||
|
"""
|
||||||
|
n = {}
|
||||||
|
n["omap"] = nx.to_dict_of_dicts(self.omap)
|
||||||
|
n["imap"] = nx.to_dict_of_dicts(self.imap)
|
||||||
|
n["emaps"] = []
|
||||||
|
for e in self.emaps:
|
||||||
|
n["emaps"].append(nx.to_dict_of_dicts(e))
|
||||||
|
# TODO: Daisy
|
||||||
|
with open(path, "wb") as f:
|
||||||
|
f.write(msgpack.dumps(n))
|
||||||
|
with open(path + ".json", "w") as f:
|
||||||
|
f.write(json.dumps(n))
|
||||||
|
|
||||||
|
def mimport(self, path: str):
|
||||||
|
"""
|
||||||
|
Import map from path
|
||||||
|
"""
|
||||||
|
ndata = ""
|
||||||
|
with open(path, "rb") as f:
|
||||||
|
ndata = msgpack.loads(f.read())
|
||||||
|
self.omap = nx.Graph(ndata["omap"])
|
||||||
|
self.imap = nx.Graph(ndata["imap"])
|
||||||
|
self.emaps = []
|
||||||
|
for e in ndata["emaps"]:
|
||||||
|
self.emaps.append(nx.Graph(e))
|
||||||
|
|
||||||
|
def addon(self, id: int):
|
||||||
|
"""
|
||||||
|
Add node on outer map
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
id: int
|
||||||
|
PierMesh node ID
|
||||||
|
"""
|
||||||
|
self.omap.add_node(id)
|
||||||
|
|
||||||
|
def addoe(self, nodea: int, nodeb: int):
|
||||||
|
"""
|
||||||
|
Add edge between nodes on outer map
|
||||||
|
"""
|
||||||
|
self.omap.add_edge(nodea, nodeb)
|
||||||
|
|
||||||
|
def addin(self, id: int):
|
||||||
|
"""
|
||||||
|
Add peer on inner map
|
||||||
|
|
||||||
|
Attributes
|
||||||
|
----------
|
||||||
|
id: int
|
||||||
|
PierMesh node ID
|
||||||
|
"""
|
||||||
|
self.imap.add_node(id)
|
||||||
|
|
||||||
|
def addie(self, nodea: int, nodeb: int):
|
||||||
|
"""
|
||||||
|
Add edge between peers on inner map
|
||||||
|
"""
|
||||||
|
self.imap.add_edge(nodea, nodeb)
|
||||||
|
|
||||||
|
def getRoute(self, senderNode: int, recipientNode: int):
|
||||||
|
"""
|
||||||
|
Get the shortest route between two nodes on the outer map (Needs checkup)
|
||||||
|
"""
|
||||||
|
return nx.shortest_path(self.omap, senderNode, recipientNode)
|
||||||
|
|
||||||
|
def render(self, pathPrefix: str = ""):
|
||||||
|
"""
|
||||||
|
Render outer and inner network mao to disk at the given path prefix
|
||||||
|
"""
|
||||||
|
nx.draw(self.omap)
|
||||||
|
plt.savefig(pathPrefix + "omap.png")
|
||||||
|
nx.draw(self.imap)
|
||||||
|
plt.savefig(pathPrefix + "imap.png")
|
|
@ -1,5 +1,5 @@
|
||||||
Network map representation
|
Network map representation
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
.. autoclass:: Bubble.map.Network
|
.. autoclass:: Siph.map.Network
|
||||||
:members:
|
:members:
|
|
@ -1,18 +1,8 @@
|
||||||
import msgpack
|
import msgpack
|
||||||
from Bubble.map import Network
|
from Siph.map import Network
|
||||||
from Components.daisy import Catch
|
from Components.daisy import Catch
|
||||||
from Components.daisy import Cache
|
from Components.daisy import Cache
|
||||||
import random, logging
|
import random
|
||||||
|
|
||||||
# DONE Catch integration
|
|
||||||
# TODO: Catch examples
|
|
||||||
#
|
|
||||||
# 🐟+🔥+🤤
|
|
||||||
# prmh.catchexample.rabbit.hutch
|
|
||||||
# 🟥|🟧|🟦
|
|
||||||
# 🖐️📡🌍
|
|
||||||
# prmh@Ashwood_Skye
|
|
||||||
# 💻💻
|
|
||||||
|
|
||||||
|
|
||||||
class Router:
|
class Router:
|
|
@ -1,5 +1,5 @@
|
||||||
Data routing logic and data
|
Data routing logic and data
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
.. autoclass:: Bubble.router.Router
|
.. autoclass:: Siph.router.Router
|
||||||
:members:
|
:members:
|
|
@ -9,8 +9,8 @@ PierMesh documentation
|
||||||
:glob:
|
:glob:
|
||||||
|
|
||||||
run
|
run
|
||||||
../ui
|
ui
|
||||||
../Bubble/*
|
../Siph/*
|
||||||
../Components/*
|
../Components/*
|
||||||
../Cryptography/*
|
../Cryptography/*
|
||||||
../Filters/*
|
../Filters/*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from meshtastic import logging, os
|
from meshtastic import logging, os
|
||||||
from Filters.base import Filter
|
from Filters.base import Filter
|
||||||
from Bubble.router import Router
|
from Siph.router import Router
|
||||||
from webui.serve import Server
|
from webui.serve import Server
|
||||||
from Transmission.transmission import Transmitter
|
from Transmission.transmission import Transmitter
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
Loading…
Reference in New Issue