Clean docs

This commit is contained in:
Agie Ashwood 2024-08-01 21:09:50 +00:00
parent 8e0d78d0c4
commit d07fcb6853
24 changed files with 85 additions and 52 deletions

6
.gitignore vendored
View File

@ -2,9 +2,9 @@ bin/
lib* lib*
share/ share/
**/__pycache__/ **/__pycache__/
src/webui/build/ src/Splash/build/
src/webui/htmx-extensions/ src/Splash/htmx-extensions/
src/webui/res/js/node_modules/ src/Splash/res/js/node_modules/
src/daisy/ src/daisy/
src/catch/ src/catch/
src/logs/ src/logs/

View File

@ -6,4 +6,4 @@ mv docs.tmp/* docs
rm -rf docs.tmp rm -rf docs.tmp
mv docs/index.md docs/readme.md mv docs/index.md docs/readme.md
sed -i '1s;^;![PierMesh logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/piermeshicon.png)\n\n;' docs/readme.md sed -i '1s;^;![PierMesh logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/piermeshicon.png)\n\n;' docs/readme.md
sed -i '1s;^;![Daisy logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/imgs/daisydisplay.png)\n\n;' docs/Components/daisy.md sed -i '1s;^;![Daisy logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/imgs/daisydisplay.png)\n\n;' docs/Daisy/Daisy.md

View File

@ -1,3 +1,5 @@
![Daisy logo](https://git.utopic.work/PierMesh/piermesh/raw/branch/main/imgs/daisydisplay.png)
Schemaless binary database Schemaless binary database
base class base class
========================== ==========================

View File

@ -1,3 +1,7 @@
SubPackets for handling SubPackets for handling
full submessages full submessages
======================= =======================
### *class* Packets.SubMessage.SubMessage
TODO

View File

@ -1,3 +1,7 @@
SubPacket for handling SubPacket for handling
individual packets of submessages individual packets of submessages
================================= =================================
### *class* Packets.SubPacket.SubPacket
TODO

View File

@ -1,6 +1,6 @@
# serve: Web UI server # serve: Web UI server
### *class* Splash.serve.Server(transmitter, catch, onodeID, network, cLog) ### *class* Splash.serve.Server(transceiver, catch, onodeID, network, cLog)
Web server that serves the web ui and provides web to node communication Web server that serves the web ui and provides web to node communication
@ -42,7 +42,7 @@ Microdot server instance
#### catch #### catch
Reference to our Catch Cache instance to pull from for servijg Catchs Reference to our Catch Cache instance to pull from for serving Catchs
* **Type:** * **Type:**
[Daisy.Catch.Catch](/PierMesh/piermesh/src/branch/main/docs/Daisy/Catch.md#Daisy.Catch.Catch) [Daisy.Catch.Catch](/PierMesh/piermesh/src/branch/main/docs/Daisy/Catch.md#Daisy.Catch.Catch)

View File

@ -6,6 +6,8 @@ Dispatches to Protocols
Packet filtering orchestration Packet filtering orchestration
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/base.py)
cLog cLog
: Reference to run.Node.cLog for logging : Reference to run.Node.cLog for logging
@ -45,18 +47,26 @@ Check if this is a self packet, if so skip
Base filtering logic, takes a single MeshTastic packet Base filtering logic, takes a single MeshTastic packet
### *class* Sponge.Protocols.bubble.filter(completeMessage, recipient, recipientNode, onodeID, todo) #### *async* bubble.filter(recipient, recipientNode, onodeID, todo)
Peer to peer protol Peer to peer protol
### *class* Sponge.Protocols.catch.filter(completeMessage, recipient, recipientNode, todo) [🔗 Bubble Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/src/Sponge/Protocols/bubble.py)
#### *async* catch.filter(recipient, recipientNode, todo)
Catch exchange protocol Catch exchange protocol
### *class* Sponge.Protocols.cryptography.filter(completeMessage, recipientNode, todo) [🔗 Catch Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/catch.py)
#### *async* cryptography.filter(recipientNode, todo)
Cryptographic operations protocol Cryptographic operations protocol
### *class* Sponge.Protocols.map.filter(completeMessage, todo) [🔗 Cryptography Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/cryptography.py)
#### *async* map.filter(todo)
Network mapping protocol Network mapping protocol
[🔗 Source](https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/map.py)

View File

@ -17,7 +17,7 @@ sphinx-quickstart on Fri Jul 26 23:30:55 2024. -->
* [`Node.cache`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.cache) * [`Node.cache`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.cache)
* [`Node.nodeInfo`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.nodeInfo) * [`Node.nodeInfo`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.nodeInfo)
* [`Node.onodeID`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.onodeID) * [`Node.onodeID`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.onodeID)
* [`Node.oTransmitter`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.oTransmitter) * [`Node.oTransceiver`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.oTransceiver)
* [`Node.processed`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.processed) * [`Node.processed`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.processed)
* [`Node.proc`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.proc) * [`Node.proc`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.proc)
* [`Node.mTasks`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.mTasks) * [`Node.mTasks`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.mTasks)
@ -27,7 +27,6 @@ sphinx-quickstart on Fri Jul 26 23:30:55 2024. -->
* [`Node.action_sendCatch()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.action_sendCatch) * [`Node.action_sendCatch()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.action_sendCatch)
* [`Node.action_sendToPeer()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.action_sendToPeer) * [`Node.action_sendToPeer()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.action_sendToPeer)
* [`Node.cLog()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.cLog) * [`Node.cLog()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.cLog)
* [`Node.monitor()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.monitor)
* [`Node.spongeListen()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.spongeListen) * [`Node.spongeListen()`](/PierMesh/piermesh/src/branch/main/docs/run.md#run.Node.spongeListen)
* [ui: TUI application](/PierMesh/piermesh/src/branch/main/docs/ui.md) * [ui: TUI application](/PierMesh/piermesh/src/branch/main/docs/ui.md)
* [`TUI`](/PierMesh/piermesh/src/branch/main/docs/ui.md#ui.TUI) * [`TUI`](/PierMesh/piermesh/src/branch/main/docs/ui.md#ui.TUI)
@ -109,10 +108,10 @@ sphinx-quickstart on Fri Jul 26 23:30:55 2024. -->
* [`Filter.protoRoute()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.base.Filter.protoRoute) * [`Filter.protoRoute()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.base.Filter.protoRoute)
* [`Filter.selfCheck()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.base.Filter.selfCheck) * [`Filter.selfCheck()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.base.Filter.selfCheck)
* [`Filter.sieve()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.base.Filter.sieve) * [`Filter.sieve()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.base.Filter.sieve)
* [`filter`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.bubble.filter) * [`bubble.filter()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.bubble.filter)
* [`filter`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.catch.filter) * [`catch.filter()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.catch.filter)
* [`filter`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.cryptography.filter) * [`cryptography.filter()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.cryptography.filter)
* [`filter`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.map.filter) * [`map.filter()`](/PierMesh/piermesh/src/branch/main/docs/Sponge/base.md#Sponge.Protocols.map.filter)
* [Header packet: Metadata packet](/PierMesh/piermesh/src/branch/main/docs/Packets/HeaderPacket.md) * [Header packet: Metadata packet](/PierMesh/piermesh/src/branch/main/docs/Packets/HeaderPacket.md)
* [`Header`](/PierMesh/piermesh/src/branch/main/docs/Packets/HeaderPacket.md#Packets.HeaderPacket.Header) * [`Header`](/PierMesh/piermesh/src/branch/main/docs/Packets/HeaderPacket.md#Packets.HeaderPacket.Header)
* [`Header.sender`](/PierMesh/piermesh/src/branch/main/docs/Packets/HeaderPacket.md#Packets.HeaderPacket.Header.sender) * [`Header.sender`](/PierMesh/piermesh/src/branch/main/docs/Packets/HeaderPacket.md#Packets.HeaderPacket.Header.sender)
@ -134,6 +133,8 @@ sphinx-quickstart on Fri Jul 26 23:30:55 2024. -->
* [`Packet.dump()`](/PierMesh/piermesh/src/branch/main/docs/Packets/Packet.md#Packets.Packet.Packet.dump) * [`Packet.dump()`](/PierMesh/piermesh/src/branch/main/docs/Packets/Packet.md#Packets.Packet.Packet.dump)
* [`Packet.parsePayload()`](/PierMesh/piermesh/src/branch/main/docs/Packets/Packet.md#Packets.Packet.Packet.parsePayload) * [`Packet.parsePayload()`](/PierMesh/piermesh/src/branch/main/docs/Packets/Packet.md#Packets.Packet.Packet.parsePayload)
* [`SinglePacket`](/PierMesh/piermesh/src/branch/main/docs/Packets/SinglePacket.md) * [`SinglePacket`](/PierMesh/piermesh/src/branch/main/docs/Packets/SinglePacket.md)
* [`SubMessage`](/PierMesh/piermesh/src/branch/main/docs/Packets/SubMessage.md)
* [`SubPacket`](/PierMesh/piermesh/src/branch/main/docs/Packets/SubPacket.md)
* [Layer 0 data transceiving](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md) * [Layer 0 data transceiving](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md)
* [`Transceiver`](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md#Transceiver.Transceiver.Transceiver) * [`Transceiver`](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md#Transceiver.Transceiver.Transceiver)
* [`Transceiver.cLog`](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md#Transceiver.Transceiver.Transceiver.cLog) * [`Transceiver.cLog`](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md#Transceiver.Transceiver.Transceiver.cLog)

View File

@ -62,12 +62,12 @@ PierMesh node ID
* **Type:** * **Type:**
str str
#### oTransmitter #### oTransceiver
LoRa transmitter Transmitter LoRa transceiver Transceiver
* **Type:** * **Type:**
Transmitter [Transceiver](/PierMesh/piermesh/src/branch/main/docs/Transceiver/Transceiver.md#Transceiver.Transceiver.Transceiver)
#### processed #### processed
@ -145,10 +145,6 @@ Convenience function that logs to the ui and log files
* **Return type:** * **Return type:**
None None
#### *async* monitor()
Monitor and log ram and cpu usage
#### *async* spongeListen() #### *async* spongeListen()
Loop to watch for tasks to do Loop to watch for tasks to do

View File

@ -184,8 +184,7 @@ class DHEFern:
publicKey = privateKey.public_key() publicKey = privateKey.public_key()
if setSelf: if setSelf:
self.publicKey = publicKey self.publicKey = publicKey
self.updateStore( self.stores["key"].update(
"key",
"self", "self",
{ {
"publicKey": self.publicKey.public_bytes( "publicKey": self.publicKey.public_bytes(

View File

@ -0,0 +1,4 @@
class SubMessage:
"""
TODO
"""

View File

@ -1,3 +1,6 @@
SubPackets for handling SubPackets for handling
full submessages full submessages
======================= =======================
.. autoclass:: Packets.SubMessage.SubMessage
:members:

View File

@ -0,0 +1,4 @@
class SubPacket:
"""
TODO
"""

View File

@ -1,3 +1,6 @@
SubPacket for handling SubPacket for handling
individual packets of submessages individual packets of submessages
================================= =================================
.. autoclass:: Packets.SubPacket.SubPacket
:members:

View File

@ -1,6 +1,8 @@
async def filter(completeMessage, recipient, recipientNode, onodeID, todo): async def filter(completeMessage, recipient, recipientNode, onodeID, todo):
""" """
Peer to peer protol Peer to peer protol
`🔗 Bubble Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/src/Sponge/Protocols/bubble.py>`_
""" """
m = completeMessage m = completeMessage
if recipientNode == onodeID: if recipientNode == onodeID:

View File

@ -1,6 +1,8 @@
async def filter(completeMessage, recipient, recipientNode, todo): async def filter(completeMessage, recipient, recipientNode, todo):
""" """
Catch exchange protocol Catch exchange protocol
`🔗 Catch Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/catch.py>`_
""" """
m = completeMessage m = completeMessage
# TODO: Sending to other nodes clients # TODO: Sending to other nodes clients

View File

@ -1,9 +1,8 @@
import logging
async def filter(completeMessage, recipientNode, todo): async def filter(completeMessage, recipientNode, todo):
""" """
Cryptographic operations protocol Cryptographic operations protocol
`🔗 Cryptography Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/cryptography.py>`_
""" """
todo.append( todo.append(
{ {

View File

@ -1,6 +1,8 @@
async def filter(completeMessage, todo): async def filter(completeMessage, todo):
""" """
Network mapping protocol Network mapping protocol
`🔗 Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/Protocols/map.py>`_
""" """
m = completeMessage m = completeMessage
todo.append( todo.append(

View File

@ -12,6 +12,8 @@ class Filter:
""" """
Packet filtering orchestration Packet filtering orchestration
`🔗 Source <https://git.utopic.work/PierMesh/piermesh/src/branch/main/Sponge/base.py>`_
cLog cLog
Reference to `run.Node.cLog` for logging Reference to `run.Node.cLog` for logging
@ -138,10 +140,10 @@ class Filter:
# responseLoop(packets_id) # responseLoop(packets_id)
pass pass
completeMessage = self.messages[packetsID] completeMessage = self.messages[packetsID]
completeMessage["data"] = Packets.reassemble(None, completeMessage) completeMessage["data"] = Message.reassemble(None, completeMessage)
del self.messages[packetsID] del self.messages[packetsID]
self.completed.append(packetsID) self.completed.append(packetsID)
self.cLog(20, "Assembly completed, routing") self.cLog(20, "Assembly completed, routing")
await self.protoRoute(completeMessage) await self.protoRoute(completeMessage)
except Exception as e: except Exception:
self.cLog(30, traceback.print_exc()) self.cLog(30, traceback.format_exc())

View File

@ -5,14 +5,11 @@ Dispatches to Protocols
.. autoclass:: Sponge.base.Filter .. autoclass:: Sponge.base.Filter
:members: :members:
.. autoclass:: Sponge.Protocols.bubble.filter .. automethod:: Sponge.Protocols.bubble.filter
:members:
.. autoclass:: Sponge.Protocols.catch.filter .. automethod:: Sponge.Protocols.catch.filter
:members:
.. autoclass:: Sponge.Protocols.cryptography.filter .. automethod:: Sponge.Protocols.cryptography.filter
:members:
.. automethod:: Sponge.Protocols.map.filter
.. autoclass:: Sponge.Protocols.map.filter
:members:

View File

@ -23,6 +23,7 @@ extensions = [
"sphinx_markdown_builder", "sphinx_markdown_builder",
"sphinx.ext.autodoc", "sphinx.ext.autodoc",
"sphinx.ext.napoleon", "sphinx.ext.napoleon",
"sphinx.ext.viewcode",
] ]
templates_path = ["_templates"] templates_path = ["_templates"]

View File

@ -150,9 +150,6 @@ class Node:
""" """
while True: while True:
if tuiOb != None: if tuiOb != None:
if tuiOb.done:
print("Terminating PierMesh service...")
self.proc.terminate()
await asyncio.sleep(10) await asyncio.sleep(10)
memmb = self.proc.memory_info().rss / (1024 * 1024) memmb = self.proc.memory_info().rss / (1024 * 1024)
memmb = round(memmb, 2) memmb = round(memmb, 2)
@ -270,7 +267,9 @@ async def logPassLoop():
await asyncio.sleep(1) await asyncio.sleep(1)
if tuiOb == None or nodeOb == None: if tuiOb == None or nodeOb == None:
await asyncio.sleep(1) await asyncio.sleep(1)
elif tuiOb.done == True: elif tuiOb.done:
tuiOb.exit()
os.system("reset")
print("Terminating PierMesh service...") print("Terminating PierMesh service...")
nodeOb.proc.terminate() nodeOb.proc.terminate()
else: else:
@ -315,10 +314,8 @@ async def main():
nodeOb.mTasks["announce"] = asyncio.create_task(nodeOb.oTransceiver.announce()) nodeOb.mTasks["announce"] = asyncio.create_task(nodeOb.oTransceiver.announce())
await asyncio.sleep(1) await asyncio.sleep(1)
await nodeOb.server.app.start_server(port=int(sys.argv[2]), debug=True) await nodeOb.server.app.start_server(port=int(sys.argv[2]), debug=True)
except KeyboardInterrupt:
sys.exit()
except Exception: except Exception:
nodeOb.cLog(20, traceback.format_exc()) logging.log(20, traceback.format_exc())
if __name__ == "__main__": if __name__ == "__main__":
@ -330,7 +327,8 @@ if __name__ == "__main__":
tuiOb = TUI() tuiOb = TUI()
tuiOb.nodeOb = nodeOb tuiOb.nodeOb = nodeOb
tuiOb.run() tuiOb.run()
except KeyboardInterrupt: except:
nodeOb.cLog(30, "Terminating PierMesh service...") try:
except Exception: nodeOb.cLog(30, traceback.format_exc())
nodeOb.cLog(30, sys.gettrace()) except:
logging.log(30, traceback.format_exc())

View File

@ -57,9 +57,9 @@ class TUI(App):
run.monitor run.monitor
""" """
self.done = True self.done = True
sys.exit("Terminating TUI...") # sys.exit("Terminating TUI...")
def compose(self) -> ComposeResult: def compose(self):
""" """
Build the TUI Build the TUI
""" """