Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/keri/app/agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from socket import gaierror

from . import httping, forwarding
from . import httping, forwarding, tocking
from .. import help
from .. import kering
from .. import core
Expand Down Expand Up @@ -295,7 +295,7 @@ def __init__(self, hby, msgs=None, cues=None, force=False, auths=None, **kwa):

super(WitnessReceiptor, self).__init__(doers=[doing.doify(self.receiptDo)], **kwa)

def receiptDo(self, tymth=None, tock=0.0, **kwa):
def receiptDo(self, tymth=None, tock=None, **kwa):
"""
Returns doifiable Doist compatible generator method (doer dog)

Expand All @@ -309,7 +309,7 @@ def receiptDo(self, tymth=None, tock=0.0, **kwa):

"""
self.wind(tymth)
self.tock = tock
self.tock = tock if tock is not None else tocking.WitnessReceiptorTock
_ = (yield self.tock)

while True:
Expand Down Expand Up @@ -450,15 +450,15 @@ def __init__(self, hby, reger=None, msgs=None, klas=None, **kwa):

super(WitnessInquisitor, self).__init__(doers=[doing.doify(self.msgDo)], **kwa)

def msgDo(self, tymth=None, tock=1.0, **opts):
def msgDo(self, tymth=None, tock=None, **opts):
"""
Returns doifiable Doist compatible generator method (doer dog)

Usage:
add result of doify on this method to doers list
"""
self.wind(tymth)
self.tock = tock
self.tock = tock if tock is not None else tocking.WitnessInquisitorTock
_ = (yield self.tock)

while True:
Expand Down Expand Up @@ -588,15 +588,15 @@ def __init__(self, hby, msgs=None, cues=None, **kwa):
self.cues = cues if cues is not None else decking.Deck()
super(WitnessPublisher, self).__init__(doers=[doing.doify(self.sendDo)], **kwa)

def sendDo(self, tymth=None, tock=0.0, **opts):
def sendDo(self, tymth=None, tock=None, **opts):
"""
Returns doifiable Doist compatible generator method (doer dog)

Usage:
add result of doify on this method to doers list
"""
self.wind(tymth)
self.tock = tock
self.tock = tock if tock is not None else tocking.WitnessPublisherTock
_ = (yield self.tock)

while True:
Expand Down
49 changes: 31 additions & 18 deletions src/keri/app/directing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import itertools
from hio.base import doing

from . import tocking
from .. import help
from ..core import eventing, routing
from ..core import parsing
Expand Down Expand Up @@ -207,7 +208,7 @@ def wind(self, tymth):
self.client.wind(tymth)


def msgDo(self, tymth=None, tock=0.0, **opts):
def msgDo(self, tymth=None, tock=None, **opts):
"""
Returns doifiable Doist compatibile generator method (doer dog) to process
incoming message stream of .kevery
Expand All @@ -227,14 +228,16 @@ def msgDo(self, tymth=None, tock=0.0, **opts):
Usage:
add result of doify on this method to doers list
"""
yield # enter context
self.wind(tymth)
self.tock = tock if tock is not None else tocking.ReactorMsgTock
_ = (yield self.tock) # enter context
if self.parser.ims:
logger.info("Client %s received:\n%s\n...\n", self.hab.name, self.parser.ims[:1024])
done = yield from self.parser.parsator(local=True) # process messages continuously
return done # should nover get here except forced close


def cueDo(self, tymth=None, tock=0.0, **opts):
def cueDo(self, tymth=None, tock=None, **opts):
"""
Returns doifiable Doist compatibile generator method (doer dog) to process
.kevery.cues deque
Expand All @@ -253,15 +256,17 @@ def cueDo(self, tymth=None, tock=0.0, **opts):
Usage:
add result of doify on this method to doers list
"""
yield # enter context
self.wind(tymth)
self.tock = tock if tock is not None else tocking.ReactorCueTock
_ = (yield self.tock) # enter context
while True:
for msg in self.hab.processCuesIter(self.kevery.cues):
self.sendMessage(msg, label="chit or receipt")
yield # throttle just do one cue at a time
yield
yield self.tock # throttle just do one cue at a time
yield self.tock
return False # should never get here except forced close

def escrowDo(self, tymth=None, tock=0.0, **opts):
def escrowDo(self, tymth=None, tock=None, **opts):
"""
Returns doifiable Doist compatibile generator method (doer dog) to process
.kevery escrows.
Expand All @@ -280,12 +285,14 @@ def escrowDo(self, tymth=None, tock=0.0, **opts):
Usage:
add result of doify on this method to doers list
"""
yield # enter context
self.wind(tymth)
self.tock = tock if tock is not None else tocking.ReactorEscrowTock
_ = (yield self.tock) # enter context
while True:
self.kevery.processEscrows()
if self.tvy is not None:
self.tvy.processEscrows()
yield
yield self.tock
return False # should never get here except forced close

def sendMessage(self, msg, label=""):
Expand Down Expand Up @@ -561,7 +568,7 @@ def wind(self, tymth):
self.remoter.wind(tymth)


def msgDo(self, tymth=None, tock=0.0, **opts):
def msgDo(self, tymth=None, tock=None, **opts):
"""
Returns doifiable Doist compatibile generator method (doer dog) to process
incoming message stream of .kevery
Expand All @@ -581,15 +588,17 @@ def msgDo(self, tymth=None, tock=0.0, **opts):
Usage:
add result of doify on this method to doers list
"""
yield # enter context
self.wind(tymth)
self.tock = tock if tock is not None else tocking.ReactantMsgTock
_ = (yield self.tock) # enter context
if self.parser.ims:
logger.info("Server %s: received:\n%s\n...\n", self.hab.name,
self.parser.ims[:1024])
done = yield from self.parser.parsator(local=True) # process messages continuously
return done # should nover get here except forced close


def cueDo(self, tymth=None, tock=0.0, **opts):
def cueDo(self, tymth=None, tock=None, **opts):
"""
Returns doifiable Doist compatibile generator method (doer dog) to process
.kevery.cues deque
Expand All @@ -608,19 +617,21 @@ def cueDo(self, tymth=None, tock=0.0, **opts):
Usage:
add result of doify on this method to doers list
"""
yield # enter context
self.wind(tymth)
self.tock = tock if tock is not None else tocking.ReactantCueTock
_ = (yield self.tock) # enter context
while True:
for msg in self.hab.processCuesIter(self.kevery.cues):
if isinstance(msg, list):
msg = bytearray(itertools.chain(*msg))

self.sendMessage(msg, label="chit or receipt or replay")
yield # throttle just do one cue at a time
yield
yield self.tock # throttle just do one cue at a time
yield self.tock
return False # should never get here except forced close


def escrowDo(self, tymth=None, tock=0.0, **opts):
def escrowDo(self, tymth=None, tock=None, **opts):
"""
Returns doifiable Doist compatibile generator method (doer dog) to process
.kevery escrows.
Expand All @@ -639,12 +650,14 @@ def escrowDo(self, tymth=None, tock=0.0, **opts):
Usage:
add result of doify on this method to doers list
"""
yield # enter context
self.wind(tymth)
self.tock = tock if tock is not None else tocking.ReactantEscrowTock
_ = (yield self.tock) # enter context
while True:
self.kevery.processEscrows()
if self.tevery is not None:
self.tevery.processEscrows()
yield
yield self.tock
return False # should never get here except forced close

def sendMessage(self, msg, label=""):
Expand Down
Loading
Loading