organize ++vi core

This commit is contained in:
Anton Dyudin 2016-01-28 15:50:11 -08:00
parent f18227a697
commit 49f8110b2d

View File

@ -57,16 +57,16 @@
[%ha p=path:beak] :: GET request
[%he p=whir] :: HEAD request
[%hi p=span:(unit span) q=mark ~] :: outbound HTTP
[%se p=whir-se q=[span (list ,@t)]] :: outbound to domain
[%se p=whir-se q=[iden (list ,@t)]] :: outbound to domain
[%si ~] :: response done
[%of p=ixor q=$|(~ whir-of)] :: associated view
[%ow p=ixor ~] :: dying view
[%on ~] :: dependency
== ::
++ whir-of ,[p=span:ship q=term r=wire] :: path in dock
++ whir-se
$? %core :: build agent
%out :: ++out mod request
++ whir-se ?(%core vi-arm) :: build/call
++ vi-arm
$? %out :: ++out mod request
%res :: ++res use result
%bak :: ++bak auth response
%in :: ++in handle code
@ -755,7 +755,7 @@
::
%news :: dependency updated
?: ?=([%se *] tee)
build:(dom-vi q.tee)
(get-news:(dom-vi q.tee) p.sih)
?. ?=([%on ~] tee)
~&(e/lost/[tee hen] +>.$)
%+ roll (~(tap in (~(get ju liz) p.sih)))
@ -1621,20 +1621,32 @@
++ abet +>(sec (~(put by sec) +<))
++ dead-this |=(a=tang (fail:abet 500 0v0 a))
++ dead-hiss |=(a=tang (give-sigh:abet(req ~(nap to req)) %| a))
++ pass-note |=([a=whir-se b=note] (pass-note:abet se/[a usr dom] b))
++ eyre-them |=([a=whir-se b=vase] (eyre-them:abet se/[a usr dom] b))
++ pass-note |=([a=whir-se b=note] (pass-note:abet se/[a usr dom] b))
:: XX block reqs until correct core checked in?
++ warn |=(a=tang ((slog (flop a)) abet))
++ pump
^+ abet
?~ cor
build
=+ ole=~(top to req)
?~ ole abet
:: process hiss
=. hen p.u.ole
?~ u.cor (eyre-them %out r.u.ole) :: don't process
(call %out hiss/r.u.ole)
++ with |*([a=vase:gate b=$+(vase abet)] |=(c=vase (b (slam a c))))
::
:: Main
::
++ cor-type ?~(cor %void ?~(u.cor %void p.u.cor))
++ has-arm ~(has in (sa (sloe cor-type)))
++ build
=- (pass-note %core (ford-req root-beak -))
:::+ %dude [|.(+)]:>%mod-samp<
:^ %mute core/[root-beak (flop %_(dom . sec/dom))]
[~[`12] `bale/!>(*(bale ,@))] :: XX specify on type?
?~ cor ~
?~ u.cor ~
?: (has-arm %wyp) ~
?: (has-arm %upd)
[~[`13] ride/[cnzy/%upd prep-cor]]~
[~[`13] `noun/(slot 13 u.cor)]~
::
++ call
|= [arm=vi-arm sam=cage]
=+ call/[ride/[cnzy/arm prep-cor] `sam]
(pass-note arm (ford-req root-beak -))
::
++ prep-cor ^- silk
?~ cor ~|(%no-core !!)
@ -1647,49 +1659,80 @@
`(bale)`[[our now (shas %bale eny) root-beak] [usr dom] key]
==
::
++ call
|= [arm=?(%bak %res %out %in) sam=cage]
=+ call/[ride/[cnzy/arm prep-cor] `sam]
(pass-note arm (ford-req root-beak -))
++ pump
^+ abet
?~ cor
build
=+ ole=~(top to req)
?~ ole abet
:: process hiss
=. hen p.u.ole
?~ u.cor (eyre-them %out r.u.ole) :: don't process
(call %out hiss/r.u.ole)
::
++ get-upd
++ fin-httr
|= vax=vase:httr
=^ ole req ~(get to req)
=> .(ole `[p=duct q=mark *]`ole) :: XX types
=. ..vi (cast-thou(hen p.ole) q.ole httr/vax) :: error?
pump
::
:: Interfaces
::
++ get-news ,_build
++ get-quay |=(quy=quay (call %in quay/!>(quy)))
++ get-req |=(a=[mark vase:hiss] pump(req (~(put to req) hen a)))
++ get-thou
|= [wir=whir-se hit=httr]
?+ wir !!
%in (call %bak httr/!>(hit))
%out
?. (has-arm %res) (fin-httr !>(hit))
(call %res httr/!>(hit))
==
::
++ get-made
|= [wir=whir-se dep=@uvH res=(each cage tang)] ^+ abet
?: ?=(%core wir) (update dep res)
%. res
?-(wir %out res-out, %res res-res, %bak res-bak, %in res-in)
::
++ update
|= [dep=@uvH gag=(each cage tang)]
~& got-upd/dep
:: ~& got-upd/dep
=. ..vi (pass-note %core [%f [%wasp our dep &]])
?~ -.gag pump(cor `q.p.gag)
?: &(?=(~ cor) ?=(~ usr))
pump(cor `~) :: userless %hiss defaults to "nop" driver
(warn p.gag)
::
++ get-made
|= [wir=whir-se dep=@uvH res=(each cage tang)] ^+ abet
?- wir
%core (get-upd dep res)
%out (res-out res)
%res (res-res res)
%in (res-in res)
%bak (res-bak res)
==
:: Result handling
::
:: XX formal dill-blit %url via hood
++ auth-print |=([%show a=purl] (slog auth-tank leaf/(earn a) ~))
++ auth-tank
=> rose/["." `~]^(turn (flop dom) |=(a=cord leaf/(trip a)))
rose/[" " `~]^~[leaf/"To authenticate" . leaf/"visit:"]
::
++ get-thou
|= [wir=whir-se hit=httr]
?+ wir !!
%in (call %bak httr/!>(hit))
%out
?. (has-arm %res) (do-httr !>(hit))
(call %res httr/!>(hit))
==
++ do-give (with !>(|=([%give a=httr] a)) fin-httr)
++ do-show (with !>(auth-print) ,_abet)
++ do-send
|= wir=whir-se ^- $+(vase _abet)
|= res=vase
(eyre-them wir (slam !>(|=([%send a=hiss] a)) res))
::
++ has-arm ~(has in (sa (sloe cor-type)))
++ cor-type ?~(cor %void ?~(u.cor %void p.u.cor))
++ do-give |=(vax=vase (do-httr (slam !>(|=([%give a=httr] a)) vax)))
++ do-httr
|= vax=vase:httr
=^ ole req ~(get to req)
=> .(ole `[p=duct q=mark *]`ole) :: XX types
=. ..vi (cast-thou(hen p.ole) q.ole httr/vax) :: error?
pump
++ handle-moves
|= a=(list ,[p=term q=$+(vase _abet)])
|= b=vase
~> %nil.
~| %bad-sec-move :: XX move ~| into ?> properly
?>((~(nest ut p:!>(*sec-move)) %& p.b) ~)
=+ opt=|.((sa (turn a head)))
|-
?~ a ~|(allowed=(opt) !!)
?: =(p.i.a -.q.b)
(q.i.a (spec b))
$(a t.a)
::
++ on-ford-fail
|= [err=$+(tang _abet) try=$+((each cage tang) _abet)]
@ -1719,26 +1762,14 @@
~| %core-mismatch
?>((~(nest ut typ) & p.roc) ~)
::
++ allow
|= a=(list ,[p=term q=$+(vase _abet)])
|= b=vase
~> %nil.
~| %bad-sec-move :: XX move ~| into ?> properly
?>((~(nest ut p:!>(*sec-move)) %& p.b) ~)
=+ opt=|.((sa (turn a head)))
|-
?~ a ~|(allowed=(opt) !!)
?: =(p.i.a -.q.b)
(q.i.a (spec b))
$(a t.a)
::
++ res-in
%+ on-error dead-this |.
(allow send/(do-send %in) ~)
(handle-moves send/(do-send %in) ~)
::
++ res-res
%+ on-error dead-hiss |.
%- allow :~
%- handle-moves :~
give/do-give
send/(do-send %out)
redo/,_pump
@ -1746,7 +1777,7 @@
::
++ res-bak
%+ on-error dead-this |.
%- allow :~
%- handle-moves :~
give/do-give
send/(do-send %in)
redo/,_pump(..vi (give-html 200 ~ exit:xml))
@ -1755,47 +1786,11 @@
++ res-out
%+ on-ford-fail dead-hiss
%+ on-error warn |.
%- allow :~
%- handle-moves :~
give/do-give
send/(do-send %out)
show/do-show
==
::
++ do-send
|= wir=whir-se ^- $+(vase _abet)
|= res=vase
(eyre-them wir (slam !>(|=([%send a=hiss] a)) res))
::
++ do-show (discard-with !>(auth-print))
++ discard-with
|= a=vase:gate ^- $+(vase _abet)
|=(b=vase =+((slam a b) abet))
::
:: XX formal dill-blit %url via hood
++ auth-print |=([%show a=purl] (slog auth-tank leaf/(earn a) ~))
++ auth-tank
=> rose/["." `~]^(turn (flop dom) |=(a=cord leaf/(trip a)))
rose/[" " `~]^~[leaf/"To authenticate" . leaf/"visit:"]
::
::
++ get-quay
|= quy=quay ^+ abet
(call %in quay/!>(quy))
::
++ rebuild build(cor ~)
++ build
=- (pass-note %core (ford-req root-beak -))
:::+ %dude [|.(+)]:>%mod-samp<
:^ %mute core/[root-beak (flop %_(dom . sec/dom))]
[~[`12] `bale/!>(*(bale ,@))] :: XX specify on type?
?~ cor ~
?~ u.cor ~
?: (has-arm %wyp) ~
?: (has-arm %upd)
[~[`13] ride/[cnzy/%upd prep-cor]]~
[~[`13] `noun/(slot 13 u.cor)]~
::
++ get-req |=(a=[mark vase:hiss] pump(req (~(put to req) hen a)))
-- --
--
. ==