mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-28 11:40:11 +03:00
spider: track desks and validate marks (wip)
This commit is contained in:
parent
c630b560ee
commit
a08c38b83c
@ -18,7 +18,7 @@
|
||||
$: starting=(map yarn [=trying =vase])
|
||||
running=trie
|
||||
tid=(map tid yarn)
|
||||
serving=(map tid [@ta =mark =desk])
|
||||
serving=(map tid [(unit @ta) =mark =desk])
|
||||
==
|
||||
::
|
||||
+$ clean-slate-any
|
||||
@ -318,14 +318,10 @@
|
||||
=* output-mark i.t.t.t.t.site.url
|
||||
=/ =tid (new-thread-id thread)
|
||||
=. serving.state
|
||||
(~(put by serving.state) tid [eyre-id output-mark desk])
|
||||
(~(put by serving.state) tid [`eyre-id output-mark desk])
|
||||
:: TODO: speed this up somehow. we spend about 15ms in this arm alone
|
||||
::
|
||||
=+ .^
|
||||
=tube:clay
|
||||
%cc
|
||||
/(scot %p our.bowl)/[desk]/(scot %da now.bowl)/json/[input-mark]
|
||||
==
|
||||
=/ tube (convert-tube %json input-mark desk bowl)
|
||||
?> ?=(^ body.request.inbound-request)
|
||||
=/ body=json (need (de-json:html q.u.body.request.inbound-request))
|
||||
=/ input=vase (slop !>(~) (tube !>(body)))
|
||||
@ -543,15 +539,11 @@
|
||||
=- (fall - `state)
|
||||
%+ bind
|
||||
(~(get by serving.state) tid)
|
||||
|= [eyre-id=@ta output=mark =desk]
|
||||
=+ .^
|
||||
=tube:clay
|
||||
%cc
|
||||
/(scot %p our.bowl)/[desk]/(scot %da now.bowl)/[output]/json
|
||||
==
|
||||
:_ state(serving (~(del by serving.state) tid))
|
||||
%+ give-simple-payload:app:server eyre-id
|
||||
(json-response:gen:server !<(json (tube vase)))
|
||||
|= [eyre-id=(unit @ta) output=mark =desk]
|
||||
=/ tube (convert-tube output %json desk bowl)
|
||||
:_ state(serving (~(del by serving.state) tid)
|
||||
%+ give-simple-payload:app:server (need eyre-id)
|
||||
(json-response:gen:server !<(%json (tube vase))
|
||||
::
|
||||
++ thread-done
|
||||
|= [=yarn =vase]
|
||||
@ -604,7 +596,7 @@
|
||||
sup.bowl
|
||||
eny.bowl
|
||||
now.bowl
|
||||
byk.bowl
|
||||
(yarn-to-byk yarn bowl)
|
||||
==
|
||||
::
|
||||
++ yarn-to-tid
|
||||
@ -623,7 +615,26 @@
|
||||
~
|
||||
`i.t.nary
|
||||
::
|
||||
++ yarn-to-byk
|
||||
|= [=yarn =bowl]
|
||||
^- beak
|
||||
=/ tid (yarn-to-tid yarn)
|
||||
%+ bind
|
||||
(~(get by serving.state) tid)
|
||||
|= [* * =desk]
|
||||
=/ boc bec
|
||||
boc(q desk)
|
||||
::
|
||||
++ clean-state
|
||||
!> ^- clean-slate
|
||||
3+state(running (turn (tap-yarn running.state) head))
|
||||
::
|
||||
++ convert-tube
|
||||
|= [from=mark to=mark =desk =bowl]
|
||||
.^
|
||||
tube:clay
|
||||
%cc
|
||||
/(scot %p our.bowl)/[desk]/(scot %da now.bowl)/[from]/[to]
|
||||
==
|
||||
|
||||
--
|
||||
|
@ -128,6 +128,19 @@
|
||||
[%done value=a]
|
||||
==
|
||||
::
|
||||
++ validate-mark
|
||||
|= [in=* =mark =desk =bowl]
|
||||
=+ .^
|
||||
sky=*
|
||||
%cb
|
||||
/(scot %p our.bowl)/[desk]/(scot %da now.bowl)/[mark]
|
||||
==
|
||||
=+ !<(=dais:clay q.u.u.sky)
|
||||
=/ res (mule |.((vale:dais in)))
|
||||
?: ?=(%| -.res)
|
||||
(mean leaf+"gall: ames vale fail {<mark>}" p.res)
|
||||
p.res
|
||||
::
|
||||
:: Take a new sign and run the strand against it
|
||||
::
|
||||
++ take
|
||||
@ -137,9 +150,16 @@
|
||||
|= [=eval-form =strand-input]
|
||||
^- [[(list card) =eval-result] _eval-form]
|
||||
=* take-loop $
|
||||
=/ validated-input=^strand-input
|
||||
=. in.strand-input
|
||||
%+ bind
|
||||
in.strand-input
|
||||
|= in=input:strand
|
||||
?. ?=(%sign -.in) in
|
||||
`(validate-mark q.cage.sign.in p.cage.sign.in q.byk.bowl.strand-input)
|
||||
:: run the strand callback
|
||||
::
|
||||
=/ =output (form.eval-form strand-input)
|
||||
=/ =output (form.eval-form validated-input)
|
||||
:: add cards to cards
|
||||
::
|
||||
=. cards
|
||||
@ -165,3 +185,4 @@
|
||||
--
|
||||
--
|
||||
--
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user