work on making end-to-end acks work

This commit is contained in:
pcmonk 2014-07-23 19:02:50 -07:00
parent 13a4df24a1
commit 2b9b533a6f
7 changed files with 247 additions and 27 deletions

View File

@ -16,6 +16,7 @@
[%waft p=sock q=*] :: response message
[%wart p=sock q=@tas r=path s=*] :: network request
[%went p=ship q=cape] :: reaction message
[%woot p=ship q=coop] :: e2e reaction message
== ::
++ hasp ,[p=ship q=term] :: see %gall
++ kiss :: in request ->$
@ -30,6 +31,7 @@
[%sith p=@p q=@uw r=?] :: imperial generator
[%wake ~] :: timer activate
[%want p=sock q=path r=*] :: send message
[%wont p=sock q=path r=*] :: e2e send message
== ::
++ move ,[p=duct q=(mold note gift)] :: local move
++ note :: out request $->
@ -52,6 +54,10 @@
$? $: %a :: from %ames
$% [%went p=ship q=cape] ::
== == ::
$: %g :: from %gall
$% [%mean p=ares] ::
[%nice ~] ::
== == ::
$: @tas ::
$% [%crud p=@tas q=(list tank)] :: by any
== == == ::
@ -658,7 +664,7 @@
%^ cat 7
p.u.yed.caq.dur
(en:r:cluy q.u.yed.caq.dur (jam ham))
?: &(=(~ lew.wod.dur) =(%back -.ham))
?: &(=(~ lew.wod.dur) |(=(%back -.ham) =(%buck -.ham)))
[wasp ..wisp]
=^ tuy +>.$
?:(=(~ lew.wod.dur) [*code +>.$] (griz now))
@ -1087,6 +1093,12 @@
=^ biz fox $(aks t.aks)
[(weld p.buz p.biz) fox]
::
++ rack :: rack:am
|= [soq=sock num=@ud cha=path cop=coop] :: e2e ack
=+ oh=(ho:(um p.soq) q.soq)
=. oh (cook:oh cop num cha)
(cans:oh cha)
::
++ wake :: wake:am
|= hen=duct :: harvest packets
^- [p=(list boon) q=fort]
@ -1100,9 +1112,9 @@
$(sox t.sox, bin (weld p.bun bin))
::
++ wise :: wise:am
|= [soq=sock hen=duct cha=path val=*] :: send a statement
|= [soq=sock hen=duct cha=path val=* ete=?] :: send a statement
^- [p=(list boon) q=fort]
zork:zank:(wool:(ho:(um p.soq) q.soq) hen cha val)
zork:zank:(wool:(ho:(um p.soq) q.soq) hen cha val ete)
::
++ um :: per server
|= our=ship
@ -1128,6 +1140,52 @@
$(pax t.pax, bin (weld (flop (wist:diz now waz ~ i.pax)) bin))
==
::
++ cans :: cans:ho:um:am
|= cha=path
=+ rum=(need (~(get by raz.bah) cha))
=. rum
%= rum
mis (~(del by mis.rum) did.rum)
did +(did.rum)
==
(coat cha rum)
::
++ coat :: coat:ho:um:am
|= [cha=path rum=race] :: update input race
^+ +>
=+ cun=(~(get by mis.rum) did.rum)
?~ cun
+>.$(raz.bah (~(put by raz.bah) cha rum))
?. =(%good p.u.cun) +>.$
?> ?=(^ r.u.cun)
%= +>.$
bin
:_ bin
:^ %mulk
[our her]
`soap`[[p:sen:gus clon:diz] cha did.rum]
u.r.u.cun
raz.bah
%+ ~(put by raz.bah) cha
%= rum
out
%+ ~(put by out.rum) did.rum
(need (~(get by out.rum) did.rum))
==
==
::
++ cook :: cook:ho:um:am
|= [cop=coop num=@ud cha=path]
^+ +> :: acknowledgment
:: ~& [%back kay dam]
=+ rum=(need (~(get by raz.bah) cha))
=+ ^- [ryn=lane dam=flap]
(need (~(get by out.rum) num))
=. rum rum(out (~(del by out.rum) num))
=. bah bah(raz (~(put by raz.bah) cha rum))
=^ roc diz (zuul:diz now [%buck cop dam ~s0])
(busk(diz (wast:diz ryn)) xong:diz roc)
::
++ done :: done:ho:um:am
|= [cha=path num=@ud] :: complete outgoing
^- [(unit duct) _+>]
@ -1256,6 +1314,19 @@
cock :: always ack a dup
(coot cha rum(mis (~(put by mis.rum) num [kay dam dut])))
::
++ deer :: deer:la:ho:um:am
|= [cha=path num=@ud dut=(unit)] :: interpret message
^+ +>
=+ ^= rum ^- race
=+ rum=(~(get by raz.bah) cha)
?~(rum *race u.rum)
%= +>.$
+>
?. (gte num did.rum)
(cook (~(get by bum.rum) num) num cha) :: always ack a dup
(coat cha rum(mis (~(put by mis.rum) num [kay dam dut])))
==
::
++ dine :: dine:la:ho:um:am
|= fud=meal :: interpret meal
^+ +>
@ -1263,11 +1334,20 @@
%back
=. +> ?.(=(%full aut) +> cock) :: finish key exch
+>(..la (tuck p.fud q.fud r.fud))
::
%buck
=. +> ?.(=(%full aut) +> ~&(%full-odd cock))
+>(..la (tock p.fud q.fud r.fud))
::
%bond
:: ~& [%bond q.fud r.fud]
?> =(p:sen:gus p.fud)
(dear q.fud r.fud ?-(kay %dead ~, %good [~ s.fud]))
::
%bund
~& [%bund q.fud r.fud]
?> =(p:sen:gus p.fud)
(deer q.fud r.fud ?-(kay %dead ~, %good [~ s.fud]))
::
%carp
=+ zol=(~(get by olz.weg) s.fud)
@ -1338,7 +1418,7 @@
==
==
+>.$
(wool [/a hen] /q/pi ~)
(wool [/a hen] /q/pi ~ |)
::
++ thaw :: thaw:ho:um:am
^+ . :: wakeup bomb
@ -1351,6 +1431,22 @@
=. diz ?:((boom:puz now) (pode:diz now) diz)
(busk xong:diz yem)
::
++ tock :: tock:ho:um:am
|= [cop=coop fap=flap cot=@dr] :: e2e ack by hash
^+ +>
=^ yoh puz (bick:puz now fap)
=. +>.$
?~ p.yoh +>.$
=^ hud +>.$
(done p.u.p.yoh q.u.p.yoh)
?~ hud +>.$
%= +>.$
bin
:_ bin
`boon`[%cake [our her] [[p:sen:gus clon:diz] u.p.yoh] cop u.hud]
==
(busk xong:diz q.yoh)
::
++ tuck :: tuck:ho:um:am
|= [kay=cape fap=flap cot=@dr] :: ack by hash
^+ +>
@ -1376,7 +1472,7 @@
(busk xong:diz feh)
::
++ wool :: wool:ho:um:am
|= [hen=duct cha=path val=*] :: send a statement
|= [hen=duct cha=path val=* ete=?] :: send a statement
^+ +>
=+ ^= rol ^- rill
=+ rol=(~(get by ryl.bah) cha)
@ -1387,7 +1483,10 @@
%+ ~(put by ryl.bah) cha
rol(sed +(sed.rol), san (~(put by san.rol) sex hen))
=+ cov=[p=p:sen:gus q=clon:diz]
(wind [cha sex] [%bond q.cov cha sex val])
%+ wind [cha sex]
?: ete
[%bund q.cov cha sex val]
[%bond q.cov cha sex val]
::
++ zest :: zest:ho:um:am
:~ :~ :* [%rtt rtt.sop.bah]
@ -1565,11 +1664,17 @@
[hen [%slip %g %init p.bon]]
~
==
::
%cake
~& [%cake p.bon q.bon r.bon]
:_ fox
:~ [s.bon %give %woot q.p.bon r.bon]
==
::
%coke
:: ~& [%tz p.bon q.bon r.bon]
:_ fox
:~ [s.bon [%give %went q.p.bon r.bon]]
:~ [s.bon %give %went q.p.bon r.bon]
==
::
%mead :_(fox [[hen [%give %hear p.bon q.bon]] ~])
@ -1645,6 +1750,31 @@
:- hen
[%pass ~ %a %want [p.p.bon him] /q/yu [q.p.bon r.bon]]
==
::
%mulk
~& [%mulk p.bon q.bon]
?> ?=([@ @ *] q.q.bon)
?> ?=(%q i.q.q.bon)
?+ i.t.q.q.bon
~& %mulk-bad
:_ fox
:~ :- (claw p.p.bon)
[%sick %wart p.bon i.t.q.q.bon t.t.q.q.bon r.bon]
==
%ge :: %gall request
?> ?=([@ ~] t.t.q.q.bon)
=+ app=`term`(need ((sand %tas) i.t.t.q.q.bon))
=+ ^= pax
:^ (scot %p p.p.bon)
(scot %p q.p.bon)
(scot %ud r.q.bon)
q.q.bon
:_ fox [hen %pass pax %g %rote p.bon app r.bon]~
%gh :: %gall response
?> ?=([@ ~] t.t.q.q.bon)
=+ app=`term`(need ((sand %tas) i.t.t.q.q.bon))
:_ fox [hen %pass ~ %g %roth p.bon app r.bon]~
==
::
%ouzo
:: ~& [%send now p.bon `@p`(mug (shaf %flap q.bon))]
@ -1671,8 +1801,24 @@
|= [tea=wire hen=duct sih=sign]
^- [(list move) _+>]
?- +<.sih
%crud [[[hen [%slip %d %flog +.sih]] ~] +>]
%went [~ +>]
%crud [[[hen [%slip %d %flog +.sih]] ~] +>]
%went [~ +>]
?(%mean %nice)
?> ?=([@ @ @ *] tea)
=+ soq=[(slav %p i.tea) (slav %p i.t.tea)]
=+ num=(slav %ud i.t.t.tea)
=+ pax=t.t.t.tea
=+ ^= fuy
=< zork =< zank
%^ ~(rack am [now fox]) soq num :- pax
?-(+<.sih %mean `p.+.sih, %nice ~)
=> %_(. fox q.fuy)
=| out=(list move)
|- ^- [p=(list move) q=_+>.^$]
?~ p.fuy
[(flop out) +>.^$]
=^ toe fox (clop now hen i.p.fuy)
$(p.fuy t.p.fuy, out (weld (flop toe) out))
==
::
++ knob
@ -1706,12 +1852,15 @@
::
%sith
(~(czar am [now fox]) p.kyz q.kyz r.kyz)
::
%want
(~(wise am [now fox]) p.kyz hen q.kyz r.kyz)
::
%wake
(~(wake am [now fox]) hen)
::
%want
(~(wise am [now fox]) p.kyz hen q.kyz r.kyz |)
::
%wont
(~(wise am [now fox]) p.kyz hen q.kyz r.kyz &)
==
=> %_(. fox q.fuy)
=| out=(list move)

View File

@ -82,7 +82,7 @@
== == ::
$: %g :: by %gall
$% [%dumb ~] ::
[%mean p=(unit ,[p=term q=(list tank)])] ::
[%mean p=ares] ::
[%nice ~] ::
[%rush p=mark q=*] ::
[%rust p=mark q=*] ::

View File

@ -1,4 +1,4 @@
!:::::
::::::
:: :: %ford, new execution control
!? 164
::::

View File

@ -1,4 +1,4 @@
:: :: %gall, user-level applications
!: :: %gall, user-level applications
!? 164
::::
|= pit=vase
@ -14,7 +14,7 @@
$% [%back p=?] :: %mess ack good/bad
[%crud p=@tas q=(list tank)] :: physical error
[%dumb ~] :: close duct
[%mean p=(unit ,[p=term q=(list tank)])] :: message failure
[%mean p=ares] :: message failure
[%meta p=vase] :: meta-gift
[%nice ~] :: message success
== ::
@ -46,6 +46,7 @@
++ note :: out request $->
$? $: %a :: to %ames
$% [%want p=sock q=path r=*] ::
[%wont p=sock q=path r=*] ::
== == ::
$: %c :: to %clay
$% [%warp p=sock q=riff] ::
@ -123,7 +124,7 @@
== == ::
$: %g :: by %gall
$% [%dumb ~] ::
[%mean p=(unit ,[p=term q=(list tank)])] ::
[%mean p=ares] ::
[%nice ~] ::
[%rush p=mark q=*] ::
[%rust p=mark q=*] ::
@ -311,7 +312,7 @@
:~ :- hen
:+ %pass
~[%x -.roc (scot %p you) app (scot %p our) (scot %ud num)]
`note`[%a [%want [you our] [%q %ge app ~] [num roc]]]
`note`[%a [%wont [you our] [%q %ge app ~] [num roc]]]
==
%= ..^^$
pol.all
@ -350,24 +351,22 @@
num=(slav %ud i.t.t.t.t.pax)
==
:_ ..^$
=+ rod=|=(ron=roon `note`[%a %want [our you] /q/gh/[app] num ron])
=+ rod=|=(ron=roon `note`[%a %wont [our you] [%q %gh app ~] num ron])
?+ -.pax !!
%m ?: ?=(%a -.sih) ~
:_ ~ :- hen
:+ %pass [%r pax]
^- note
?+ -.sih ~& [%gall-gave-m -.sih] !!
%f
?- -.p.+.sih
%& [%g %mess [our app] you `cage`q.p.p.+.sih]
%| (rod %e ~ %ford-fail p.p.+.sih)
%| [%give %mean ~ %ford-fail p.p.+.sih]
%& [%pass [%r pax] %g %mess [our app] you `cage`q.p.p.+.sih]
==
::
%g
?- -.+.sih
%dumb !!
%mean (rod %e p.+.sih)
%nice (rod %k ~)
%mean [%give %mean p.+.sih]
%nice [%give %nice ~]
%rush !!
%rust !!
==
@ -873,7 +872,10 @@
[%meta (spec (slot 15 caq))]
::
[%give p=[p=@tas q=*]]
[%give (sumo (spec (slot 3 caq)))]
:- %give
?: ?=(%mean p.p.q.caq) [%mean (ares q.p.q.caq)]
?: ?=(%nice p.p.q.caq) [%nice ~]
(sumo (spec (slot 3 caq)))
==
::
++ warm :: vase has arm

View File

@ -2246,6 +2246,7 @@
r=(map ,@ta ankh) :: folders
== ::
++ apex ,[p=@uvI q=(map ,@ta ,@uvI) r=(map ,@ta ,~)] :: node report (old)
++ ares (unit ,[p=term q=(list tank)]) :: possible error
++ ball ,@uw :: statement payload
++ bait ,[p=skin q=@ud r=dove] :: fmt nrecvd spec
++ bath :: convo per client
@ -2265,9 +2266,11 @@
++ boat ,[(list slip) tart] :: user stage
++ boon :: fort output
$% [%beer p=ship q=@uvG] :: gained ownership
[%cake p=sock q=soap r=coop s=duct] :: e2e message result
[%coke p=sock q=soap r=cape s=duct] :: message result
[%mead p=lane q=rock] :: accept packet
[%milk p=sock q=soap r=*] :: accept message
[%mulk p=sock q=soap r=*] :: e2e pass message
[%ouzo p=lane q=rock] :: transmit packet
[%wine p=sock q=tape] :: notify user
== ::
@ -2309,6 +2312,7 @@
$% [& p=twig] :: transform
[| p=(list ,@tas)] :: alter
== ::
++ coop (unit ares) :: e2e ack
++ corn :: flow by server
$: hen=duct :: admin channel
nys=(map flap bait) :: packets incoming
@ -2510,7 +2514,9 @@
++ math (map ,@t (list ,@t)) :: semiparsed headers
++ meal :: payload
$% [%back p=cape q=flap r=@dr] :: acknowledgment
[%buck p=coop q=flap r=@dr] :: e2e ack
[%bond p=life q=path r=@ud s=*] :: message
[%bund p=life q=path r=@ud s=*] :: e2e message
[%carp p=@ q=@ud r=@ud s=flap t=@] :: skin/inx/cnt/hash
[%fore p=ship q=(unit lane) r=@] :: forwarded packet
== ::
@ -2585,8 +2591,9 @@
== ::
++ race :: inbound stream
$: did=@ud :: filled sequence
bum=(map ,@ud ,%dead) ::
bum=(map ,@ud ares) ::
mis=(map ,@ud ,[p=cape q=flap r=(unit)]) :: misordered
out=(map ,@ud ,[p=lane q=flap]) :: processing
== ::
++ rank ?(%czar %king %duke %earl %pawn) :: ship width class
++ rant :: namespace binding

29
main/app/readed/core.hoon Normal file
View File

@ -0,0 +1,29 @@
!:
:: Read ::
|_ [hid=hide vat=tape]
++ peer |= [ost=bone ship pax=path]
~& pax
?~ pax
$(pax ~[(rsh 3 1 (scot %p our.hid))])
?> ?=([cord ~] pax)
:_ +>
:~ [ost %pass /ret %g %show [(slav %p (cat 3 '~' i.pax)) %written] our.hid /]
:^ ost %pass /heyya
:^ %g %mess [(slav %p (cat 3 '~' i.pax)) %written]
:+ our.hid %json !>(`json`[%s %hallo])
==
++ pour
|= [pax=path sin=*]
:_ +>
?: =(/ret pax)
=+ sin=;;(,[%g @tas mark *] sin)
=+ gif=;;(,[?(%rust %rush) %hymn manx] +.sin)
%+ turn (~(tap in (~(get ju pus.hid) /)))
|= ost=bone
[ost give/gif]
?: =(/heyya pax)
~& [%pour-acked sin]
~
~& %pour-bad ~
--

View File

@ -0,0 +1,33 @@
!:
=> |%
++ gift
$% [%mean p=ares]
[%nice ~]
==
++ move ,[p=bone q=(mold note gift)]
++ note ,~
--
:: Write ::
|_ [hid=hide vat=tape]
++ root
[(crip <our.hid>) %main (crip <lat.hid>) ~]
++ peek |= [you=ship pax=path]
:- %hymn
;html
;head
;title: Writer
;script:"{(trip (,@ (need (file (welp root /lib/urb/js)))))}"
==
;body
;p: Write things!
;+ =+ js="urb.send(\{appl:{<`@t`app.hid>}, data:texx.value})"
;textarea(id "texx", onchange js):"{vat}"
==
==
++ poke-json
|= [ost=bone you=ship jon=json]
^- [(list move) _+>]
=. vat (need (sa:jo jon))
~& vat
[[`move`[ost %give %nice ~] ~] +>.$]
--