Skip to content
4 changes: 2 additions & 2 deletions src/hio/base/multidoing.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def serviceRxMemos(self):
Override in subclass to handle result(s) and put them somewhere
"""
while self.rxms:
memo, src, oid = self._serviceOneRxMemo()
memo, src, vid = self._serviceOneRxMemo()
self.logger.debug("Boss Peer RX: name=%s rx from src=%s memo=%s.",
self.name, src, memo)

Expand Down Expand Up @@ -818,7 +818,7 @@ def serviceRxMemos(self):
Override in subclass to handle result(s) and put them somewhere
"""
while self.rxms:
memo, src, oid = self._serviceOneRxMemo()
memo, src, vid = self._serviceOneRxMemo()
self.logger.debug("Hand Peer RX: name=%s rx from src=%s memo=%s.",
self.name, src, memo)

Expand Down
5 changes: 3 additions & 2 deletions src/hio/core/memo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"""


from .memoing import (Versionage, Sizage, MemoDex, GramDex, AuthDex, Keyage,
from .memoing import (Versionage, Sizage, Keyage,
MemoDex, ZeroDex, GramDex, AuthDex, AckDex,
openMemoer, Memoer, MemoerDoer,
openSM, SureMemoer, SureMemoerDoer)
openAM, AuthMemoer, AuthMemoerDoer)

891 changes: 541 additions & 350 deletions src/hio/core/memo/memoing.py

Large diffs are not rendered by default.

58 changes: 36 additions & 22 deletions src/hio/core/udp/peermemoing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class PeerMemoer(Peer, Memoer):


Inherited Class Attributes:
BufSize (int): used to set default buffer size for transport datagram buffers
MaxGramSize (int): max gram bytes for this transport

Version (Versionage): default version namedtuple of form (major: int, minor: int)
Codex (GramDex): dataclass ref to gram codex
Codes (dict): maps codex names to codex values
Expand All @@ -31,6 +29,8 @@ class PeerMemoer(Peer, Memoer):
Sizes (dict): gram head part sizes Sizage instances keyed by gram codes
MaxMemoSize (int): absolute max memo size
MaxGramCount (int): absolute max gram count
BufSize (int): used to set default buffer size for transport datagram buffers
Tymeout (float): default timeout for retry tymer(s) if any

Inherited Attributes:
name (str): unique identifier of peer for management purposes
Expand All @@ -56,20 +56,20 @@ class PeerMemoer(Peer, Memoer):
counts (dict): keyed by mid (memoID) that holds the gram count from
the first gram for the memo. This enables lookup of the gram count when
fusing its grams.
oids (dict[mid: (oid | None)]): keyed by mid that holds the origin ID str for
vids (dict[mid: (vid | None)]): keyed by mid that holds the verifier ID str for
the memo indexed by its mid (memoID). This enables reattaching
the oid to memo when placing fused memo in rxms deque.
Vid is only present when signed header otherwise oid is None
the vid to memo when placing fused memo in rxms deque.
Vid is only present when signed header otherwise vid is None
rxms (deque): holding rx (receive) memo tuples desegmented from rxgs grams
each entry in deque is tuple of form:
(memo: str, src: str, oid: str) where:
memo is fused memo, src is source addr, oid is origin ID
(memo: str, src: str, vid: str) where:
memo is fused memo, src is source addr, vid is verifier ID
txms (deque): holding tx (transmit) memo tuples to be segmented into
txgs grams where each entry in deque is tuple of form
(memo: str, dst: str, oid: str | None)
(memo: str, dst: str, vid: str | None)
memo is memo to be partitioned into gram
dst is dst addr for grams
oid is verification id when gram is to be signed or None otherwise
vid is verification id when gram is to be signed or None otherwise
txgs (deque): grams to transmit, each entry is duple of form:
(gram: bytes, dst: str).
txbs (tuple): current transmisstion duple of form:
Expand All @@ -79,30 +79,44 @@ class PeerMemoer(Peer, Memoer):
for (gram, dst)
echos (deque): holding echo receive duples for testing. Each duple of
form: (gram: bytes, dst: str).
inbox (deque): holds final received complete memos for testing when not
overridden in subclass to further process otherwise
tymeout (float): default timeout for retry tymer(s) if any
tymers (dict): keys are tid and values are Tymers for retry tymers for
each inflight tx


Inherited Properties:
tyme (float or None): relative cycle time of associated Tymist which is
provided by calling .tymth function wrapper closure which is obtained
from Tymist.tymen().
None means not assigned yet.
tymth (Callable or None): function wrapper closure returned by
Tymist.tymen() method. When .tymth is called it returns associated
Tymist.tyme. Provides injected dependency on Tymist cycle tyme base.
None means not assigned yet.

host (str): element of .ha duple
port (int): element of .ha duple
path (tuple): .ha (host, port) alias to match .uxd

code (bytes | None): gram code for gram header when rending for tx
curt (bool): True means when rending for tx encode header in base2; False means when rending for tx encode header in base64
size (int): gram size when rending for tx.
verific (bool): True means any rx grams must be signed; False otherwise
authic (bool): True means any rx grams must be signed; False otherwise
echoic (bool): True means use .echos in .send and .receive to mock transport.
keep (dict): labels are oids and values are Keyage instances.
oid (str|None): own oid defaults used to lookup keys to sign on tx

Notes:
- size: first gram size = over head size + neck size + body size;
subsequent grams use over head size + body size; gram body size is at
least one and is limited by MaxGramSize and MaxGramCount relative to
MaxMemoSize.
- echoic: each entry in .echos is (gram: bytes, src: str); default echo
is (b'', None); when False it may be overridden by method parameter.
- keep: Keyage is namedtuple("Keyage", "sigkey verkey") with private
signing key sigkey and public verifying key verkey.
keep (dict): labels are vids and values are Keyage instances.
vid (str|None): own vid defaults used to lookup keys to sign on tx

Notes::
- size: first gram size = over head size + neck size + body size;
subsequent grams use over head size + body size; gram body size is at
least one and is limited by MaxGramSize and MaxGramCount relative to
MaxMemoSize.
- echoic: each entry in .echos is (gram: bytes, src: str); default echo
is (b'', None); when False it may be overridden by method parameter.
- keep: Keyage is namedtuple("Keyage", "sigkey verkey") with private
signing key sigkey and public verifying key verkey.

"""

Expand Down
2 changes: 0 additions & 2 deletions src/hio/core/uxd/peermemoing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ class PeerMemoer(Peer, Memoer):
"""Class for sending memograms over UXD transport
Mixin base classes Peer and Memoer to attain memogram over uxd transport.


Inherited Class Attributes:
See Peer Class
See memoing.Memoer Class


Inherited Attributes:
See Peer Class
See Memoer Class
Expand Down
8 changes: 4 additions & 4 deletions src/hio/help/helping.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,19 +549,19 @@ def codeB64ToB2(s):


def codeB2ToB64(b, l):
"""Convert l sextets from base2 b to base64 str
"""Converts first l sextets of base2 b bytes to base64 str and returns

Returns:
Returns::
code (str): conversion (encode) of l Base2 sextets from front of b
to Base64 chars.
to Base64 chars.

One char for each of l sextets from front (left) of b.
This is useful for encoding as code characters, sextets from the front of
a Base2 bytes (byte string). Must provide l because of ambiguity between l=3
and l=4. Both require 3 bytes in b. Trailing pad bits are removed so
returned sextets as characters are right aligned .

Parameters:
Parameters::
b (bytes | str): target from which to nab sextets
l (int): number of sextets to convert from front of b
"""
Expand Down
Loading
Loading