From f9e6503815208cb15b7d0705a2885cd9022d09d8 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Fri, 4 Dec 2015 14:21:37 -0800 Subject: [PATCH] added kiss-eyre %serv setting web server root beam |serve ?(desk path:beam) to set --- ape/hood.hoon | 1 + arvo/eyre.hoon | 23 ++++++++++++++++------- arvo/gall.hoon | 1 + arvo/zuse.hoon | 1 + gen/hood/serve.hoon | 17 +++++++++++++++++ lib/helm.hoon | 5 +++++ 6 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 gen/hood/serve.hoon diff --git a/ape/hood.hoon b/ape/hood.hoon index 38e41042c..85b876604 100644 --- a/ape/hood.hoon +++ b/ape/hood.hoon @@ -102,6 +102,7 @@ ++ poke-helm-reload (wrap poke-reload):from-helm ++ poke-helm-reload-desk (wrap poke-reload-desk):from-helm ++ poke-helm-reset (wrap poke-reset):from-helm +++ poke-helm-serve (wrap poke-serve):from-helm ++ poke-helm-send-hi (wrap poke-send-hi):from-helm ++ poke-helm-send-ask (wrap poke-send-ask):from-helm ++ poke-helm-verb (wrap poke-verb):from-helm diff --git a/arvo/eyre.hoon b/arvo/eyre.hoon index ad895461d..e92d23849 100644 --- a/arvo/eyre.hoon +++ b/arvo/eyre.hoon @@ -66,9 +66,10 @@ -- :: |% :: models ++ bolo :: eyre state - $: %3 :: version + $: %4 :: version gub=@t :: random identity hov=(unit ship) :: master for remote + top=beam :: ford serve prefix ged=duct :: client interface ded=(set duct) :: killed requests lyv=(map duct live) :: living requests @@ -561,13 +562,19 @@ |= kyz=kiss ^+ +> =. our ?~(hov our u.hov) :: XX + =. p.top our :: XX necessary? ?- -.kyz %born +>.$(ged hen) :: register external + %serv + =< ~&([%serving (tope top)] .) + ?^(p.kyz +>.$(top p.kyz) +>.$(q.top p.kyz)) + :: %crud +>.$(mow [[hen %slip %d %flog kyz] mow]) :: %init :: register ownership - +>.$(hov ?~(hov [~ p.kyz] [~ (min u.hov p.kyz)])) + =. our ?~(hov p.kyz (min u.hov p.kyz)) + +>.$(hov [~ our], top [[our %home ud/0] /web]) :: %this :: inbound request %- emule |. ^+ ..apex @@ -1595,19 +1602,21 @@ ~ :: ++ load :: take previous state + =+ bolo-3=,_[%3 +(|2 |3.+)]:*bolo :: no top =+ even-2=?(even [%mean p=[dock path] *]) :: old %quit =+ ^= stem-2 :: no die, sus ,_=+(*stem -(|3 |5.-, q.eve *(map ,@u even-2))) - =+ bolo-2=,_[%2 %*(+ *bolo wix *(map ixor stem-2))] + =+ bolo-2=,_[%2 %*(+ *bolo-3 wix *(map ixor stem-2))] =+ bolo-1=,_[%1 +(|4 |5.+)]:*bolo-2 :: no lyv - |= old=?(bolo bolo-1 bolo-2) + |= old=?(bolo bolo-1 bolo-2 bolo-3) ^+ ..^$ ?- -.old - %3 ..^$(+>- old) + %4 ..^$(+>- old) + %3 $(-.old %4, |2.+.old [[[(need hov.old) %home ud/0] /web] |2.+.old]) %2 =+ evn=|=(a=even-2 ?+(-.a a %mean [%quit p.a])) =+ stm=|=(a=stem-2 a(|3 [now ~ |3.a(q.eve (~(run by q.eve.a) evn))])) - $(old [%3 +.old(wix (~(run by wix.old) stm))]) - %1 $(old [%2 +(|4 [~ |4.+])]:old) + $(-.old %3, wix.old (~(run by wix.old) stm)) + %1 $(-.old %2, |4.+.old [~ |4.+.old]) == :: ++ scry diff --git a/arvo/gall.hoon b/arvo/gall.hoon index f77502516..012ceceb9 100644 --- a/arvo/gall.hoon +++ b/arvo/gall.hoon @@ -1166,6 +1166,7 @@ %merg `%c %mont `%c %ogre `%c + %serv `%e %them `%e %wait `%b %want `%a diff --git a/arvo/zuse.hoon b/arvo/zuse.hoon index cbc3fcef5..cb36da7e9 100644 --- a/arvo/zuse.hoon +++ b/arvo/zuse.hoon @@ -2478,6 +2478,7 @@ [%crud p=@tas q=(list tank)] :: XX rethink [%hiss p=mark q=cage] :: outbound user req [%init p=@p] :: report install + [%serv p=$|(desk beam)] :: set serving root [%them p=(unit hiss)] :: outbound request [%they p=@ud q=httr] :: inbound response [%this p=? q=clip r=httq] :: inbound request diff --git a/gen/hood/serve.hoon b/gen/hood/serve.hoon new file mode 100644 index 000000000..3c569bf14 --- /dev/null +++ b/gen/hood/serve.hoon @@ -0,0 +1,17 @@ +:: +:::: /hoon/serve/hood/gen + :: +/? 314 +:: +:::: + !: +:- %say +|= $: [now=@da eny=@uvI bec=beak] + [[pax=$|(term [i=span t=path]) ~] ~] + == +:- %helm-serve +?@ pax pax +=+ bem=(need (tome pax)) +?. =([%da now] r.bem) :: XX actual sentinel + bem +bem(r [%ud 0]) diff --git a/lib/helm.hoon b/lib/helm.hoon index e8acf5250..7ca3f8ff8 100644 --- a/lib/helm.hoon +++ b/lib/helm.hoon @@ -47,6 +47,7 @@ $% [%cash wire p=@p q=buck] :: [%conf wire dock %load ship term] :: [%flog wire flog] :: + [%serv wire ?(desk beam)] :: [%poke wire dock pear] :: [%wont wire sock path *] :: send message == :: @@ -94,6 +95,10 @@ %^ emit %poke /helm/ask/(scot %p ~doznec) [[~doznec %ask] %ask-mail mel] :: +++ poke-serve + |= top=?(desk beam) =< abet + (emit %serv /helm/serv top) +:: ++ poke-hi |=(mes=@t abet:(emit %flog /di %text "< {}: {(trip mes)}")) ++ coup-hi |= [pax=path cop=(unit tang)] =< abet