2019-11-15 00:31:44 +03:00
|
|
|
/- spider
|
2019-11-16 14:25:30 +03:00
|
|
|
/+ libstrand=strand
|
|
|
|
=, strand=strand:libstrand
|
|
|
|
=, strand-fail=strand-fail:libstrand
|
2019-09-26 07:12:58 +03:00
|
|
|
|%
|
2019-09-29 07:44:31 +03:00
|
|
|
++ send-raw-cards
|
2019-11-19 07:36:21 +03:00
|
|
|
|= cards=(list =card:agent:gall)
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= strand-input:strand
|
2019-09-29 07:44:31 +03:00
|
|
|
[cards %done ~]
|
|
|
|
::
|
2019-09-26 07:12:58 +03:00
|
|
|
++ send-raw-card
|
2019-11-19 07:36:21 +03:00
|
|
|
|= =card:agent:gall
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-26 07:12:58 +03:00
|
|
|
^- form:m
|
2019-09-29 07:44:31 +03:00
|
|
|
(send-raw-cards card ~)
|
|
|
|
::
|
2019-10-11 01:30:24 +03:00
|
|
|
++ ignore
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-10-11 01:30:24 +03:00
|
|
|
`[%fail %ignore ~]
|
|
|
|
::
|
2019-09-29 07:44:31 +03:00
|
|
|
++ get-bowl
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,bowl:strand)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-29 07:44:31 +03:00
|
|
|
`[%done bowl.tin]
|
2019-09-26 07:12:58 +03:00
|
|
|
::
|
|
|
|
++ get-time
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,@da)
|
2019-09-26 07:12:58 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-26 07:12:58 +03:00
|
|
|
`[%done now.bowl.tin]
|
|
|
|
::
|
2019-09-29 07:44:31 +03:00
|
|
|
++ get-our
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,ship)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-29 07:44:31 +03:00
|
|
|
`[%done our.bowl.tin]
|
|
|
|
::
|
2019-10-11 01:30:24 +03:00
|
|
|
++ get-entropy
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,@uvJ)
|
2019-10-11 01:30:24 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-10-11 01:30:24 +03:00
|
|
|
`[%done eny.bowl.tin]
|
|
|
|
::
|
2019-09-29 07:44:31 +03:00
|
|
|
:: Convert skips to %ignore failures.
|
|
|
|
::
|
|
|
|
:: This tells the main loop to try the next handler.
|
|
|
|
::
|
|
|
|
++ handle
|
|
|
|
|* a=mold
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,a)
|
2019-09-29 07:44:31 +03:00
|
|
|
|= =form:m
|
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-29 07:44:31 +03:00
|
|
|
=/ res (form tin)
|
|
|
|
=? next.res ?=(%skip -.next.res)
|
|
|
|
[%fail %ignore ~]
|
|
|
|
res
|
|
|
|
::
|
|
|
|
:: Wait for a poke with a particular mark
|
|
|
|
::
|
|
|
|
++ take-poke
|
2019-09-26 08:43:14 +03:00
|
|
|
|= =mark
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,vase)
|
2019-09-26 08:43:14 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-29 07:44:31 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
2019-09-26 08:43:14 +03:00
|
|
|
~ `[%wait ~]
|
|
|
|
[~ %poke @ *]
|
|
|
|
?. =(mark p.cage.u.in.tin)
|
2019-09-29 07:44:31 +03:00
|
|
|
`[%skip ~]
|
2019-09-26 08:43:14 +03:00
|
|
|
`[%done q.cage.u.in.tin]
|
|
|
|
==
|
|
|
|
::
|
2019-09-29 07:44:31 +03:00
|
|
|
::
|
|
|
|
::
|
|
|
|
++ take-sign-arvo
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,[wire sign-arvo])
|
2019-09-26 07:12:58 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-26 07:12:58 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
2019-09-29 07:44:31 +03:00
|
|
|
[~ %sign *]
|
|
|
|
`[%done [wire sign-arvo]:u.in.tin]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Wait for a subscription update on a wire
|
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
++ take-fact-prefix
|
2019-11-06 10:24:41 +03:00
|
|
|
|= =wire
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,[path cage])
|
2019-11-06 10:24:41 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-11-06 10:24:41 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
2019-11-07 09:19:32 +03:00
|
|
|
[~ %agent * %fact *]
|
2019-12-04 10:53:42 +03:00
|
|
|
?. =(watch+wire (scag +((lent wire)) wire.u.in.tin))
|
2019-11-06 10:24:41 +03:00
|
|
|
`[%skip ~]
|
2019-11-10 06:09:02 +03:00
|
|
|
`[%done (slag (lent wire) wire.u.in.tin) cage.sign.u.in.tin]
|
2019-11-06 10:24:41 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Wait for a subscription update on a wire
|
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
++ take-fact
|
2019-09-29 07:44:31 +03:00
|
|
|
|= =wire
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,cage)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-29 07:44:31 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
2019-11-07 09:19:32 +03:00
|
|
|
[~ %agent * %fact *]
|
|
|
|
?. =(watch+wire wire.u.in.tin)
|
2019-09-26 07:12:58 +03:00
|
|
|
`[%skip ~]
|
2019-11-10 06:09:02 +03:00
|
|
|
`[%done cage.sign.u.in.tin]
|
2019-09-26 07:12:58 +03:00
|
|
|
==
|
|
|
|
::
|
2019-11-06 10:24:41 +03:00
|
|
|
:: Wait for a subscription close
|
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
++ take-kick
|
2019-11-06 10:24:41 +03:00
|
|
|
|= =wire
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-11-06 10:24:41 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-11-06 10:24:41 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
2019-11-07 09:19:32 +03:00
|
|
|
[~ %agent * %kick *]
|
|
|
|
?. =(watch+wire wire.u.in.tin)
|
2019-11-06 10:24:41 +03:00
|
|
|
`[%skip ~]
|
|
|
|
`[%done ~]
|
|
|
|
==
|
|
|
|
::
|
2019-09-26 07:12:58 +03:00
|
|
|
++ echo
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-26 07:12:58 +03:00
|
|
|
^- form:m
|
2019-09-29 07:44:31 +03:00
|
|
|
%- (main-loop ,~)
|
|
|
|
:~ |= ~
|
|
|
|
^- form:m
|
|
|
|
;< =vase bind:m ((handle ,vase) (take-poke %echo))
|
|
|
|
=/ message=tape !<(tape vase)
|
|
|
|
%- (slog leaf+"{message}..." ~)
|
|
|
|
;< ~ bind:m (sleep ~s2)
|
|
|
|
%- (slog leaf+"{message}.." ~)
|
|
|
|
(pure:m ~)
|
2019-09-26 08:43:14 +03:00
|
|
|
::
|
2019-09-29 07:44:31 +03:00
|
|
|
|= ~
|
|
|
|
^- form:m
|
|
|
|
;< =vase bind:m ((handle ,vase) (take-poke %over))
|
|
|
|
%- (slog leaf+"over..." ~)
|
|
|
|
(pure:m ~)
|
2019-09-26 08:43:14 +03:00
|
|
|
==
|
2019-09-26 07:12:58 +03:00
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
++ take-watch
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,path)
|
|
|
|
|= tin=strand-input:strand
|
2019-10-11 01:30:24 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
2019-11-07 09:19:32 +03:00
|
|
|
[~ %watch *]
|
2019-10-11 01:30:24 +03:00
|
|
|
`[%done path.u.in.tin]
|
|
|
|
==
|
|
|
|
::
|
2019-09-26 07:12:58 +03:00
|
|
|
++ take-wake
|
2019-10-11 01:30:24 +03:00
|
|
|
|= until=(unit @da)
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-26 07:12:58 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-26 07:12:58 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
|
|
|
[~ %sign [%wait @ ~] %b %wake *]
|
2019-10-11 01:30:24 +03:00
|
|
|
?. |(?=(~ until) =(`u.until (slaw %da i.t.wire.u.in.tin)))
|
2019-09-26 07:12:58 +03:00
|
|
|
`[%skip ~]
|
2019-09-27 20:40:22 +03:00
|
|
|
?~ error.sign-arvo.u.in.tin
|
|
|
|
`[%done ~]
|
|
|
|
`[%fail %timer-error u.error.sign-arvo.u.in.tin]
|
2019-09-26 07:12:58 +03:00
|
|
|
==
|
|
|
|
::
|
2019-09-29 07:44:31 +03:00
|
|
|
++ take-poke-ack
|
|
|
|
|= =wire
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-29 07:44:31 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
|
|
|
[~ %agent * %poke-ack *]
|
|
|
|
?. =(wire wire.u.in.tin)
|
|
|
|
`[%skip ~]
|
2019-11-10 06:09:02 +03:00
|
|
|
?~ p.sign.u.in.tin
|
2019-09-29 07:44:31 +03:00
|
|
|
`[%done ~]
|
2019-11-10 06:09:02 +03:00
|
|
|
`[%fail %poke-fail u.p.sign.u.in.tin]
|
2019-09-29 07:44:31 +03:00
|
|
|
==
|
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
++ take-watch-ack
|
2019-09-29 07:44:31 +03:00
|
|
|
|= =wire
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-29 07:44:31 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
2019-11-07 09:19:32 +03:00
|
|
|
[~ %agent * %watch-ack *]
|
|
|
|
?. =(watch+wire wire.u.in.tin)
|
2019-09-29 07:44:31 +03:00
|
|
|
`[%skip ~]
|
2019-11-10 06:09:02 +03:00
|
|
|
?~ p.sign.u.in.tin
|
2019-09-29 07:44:31 +03:00
|
|
|
`[%done ~]
|
2019-11-10 06:09:02 +03:00
|
|
|
`[%fail %watch-ack-fail u.p.sign.u.in.tin]
|
2019-09-29 07:44:31 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ poke
|
|
|
|
|= [=dock =cage]
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
2019-11-19 07:36:21 +03:00
|
|
|
=/ =card:agent:gall [%pass /poke %agent dock %poke cage]
|
2019-09-29 07:44:31 +03:00
|
|
|
;< ~ bind:m (send-raw-card card)
|
|
|
|
(take-poke-ack /poke)
|
|
|
|
::
|
|
|
|
++ poke-our
|
|
|
|
|= [=term =cage]
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
|
|
|
;< our=@p bind:m get-our
|
|
|
|
(poke [our term] cage)
|
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
++ watch
|
2019-09-29 07:44:31 +03:00
|
|
|
|= [=wire =dock =path]
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
2019-11-19 07:36:21 +03:00
|
|
|
=/ =card:agent:gall [%pass watch+wire %agent dock %watch path]
|
2019-09-29 07:44:31 +03:00
|
|
|
;< ~ bind:m (send-raw-card card)
|
2019-11-07 09:19:32 +03:00
|
|
|
(take-watch-ack wire)
|
2019-09-29 07:44:31 +03:00
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
++ watch-our
|
2019-09-29 07:44:31 +03:00
|
|
|
|= [=wire =term =path]
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
|
|
|
;< our=@p bind:m get-our
|
2019-11-07 09:19:32 +03:00
|
|
|
(watch wire [our term] path)
|
2019-09-29 07:44:31 +03:00
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
++ leave
|
2019-09-29 07:44:31 +03:00
|
|
|
|= [=wire =dock]
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
2019-11-19 07:36:21 +03:00
|
|
|
=/ =card:agent:gall [%pass watch+wire %agent dock %leave ~]
|
2019-09-29 07:44:31 +03:00
|
|
|
(send-raw-card card)
|
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
++ leave-our
|
2019-09-29 07:44:31 +03:00
|
|
|
|= [=wire =term]
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-29 07:44:31 +03:00
|
|
|
^- form:m
|
|
|
|
;< our=@p bind:m get-our
|
2019-11-07 09:19:32 +03:00
|
|
|
(leave wire [our term])
|
2019-09-29 07:44:31 +03:00
|
|
|
::
|
2019-11-07 09:19:32 +03:00
|
|
|
++ rewatch
|
2019-11-06 10:24:41 +03:00
|
|
|
|= [=wire =dock =path]
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-11-07 09:19:32 +03:00
|
|
|
;< ~ bind:m ((handle ,~) (take-kick wire))
|
|
|
|
;< ~ bind:m (flog-text "rewatching {<dock>} {<path>}")
|
|
|
|
;< ~ bind:m (watch wire dock path)
|
2019-11-06 10:24:41 +03:00
|
|
|
(pure:m ~)
|
|
|
|
::
|
2019-09-26 07:12:58 +03:00
|
|
|
++ wait
|
|
|
|
|= until=@da
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-26 07:12:58 +03:00
|
|
|
^- form:m
|
2019-10-11 01:30:24 +03:00
|
|
|
;< ~ bind:m (send-wait until)
|
|
|
|
(take-wake `until)
|
2019-09-26 07:12:58 +03:00
|
|
|
::
|
|
|
|
++ sleep
|
|
|
|
|= for=@dr
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-26 07:12:58 +03:00
|
|
|
^- form:m
|
|
|
|
;< now=@da bind:m get-time
|
|
|
|
(wait (add now for))
|
2019-09-26 08:43:14 +03:00
|
|
|
::
|
2019-10-11 01:30:24 +03:00
|
|
|
++ send-wait
|
|
|
|
|= until=@da
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-10-11 01:30:24 +03:00
|
|
|
^- form:m
|
2019-11-19 07:36:21 +03:00
|
|
|
=/ =card:agent:gall
|
2019-10-11 01:30:24 +03:00
|
|
|
[%pass /wait/(scot %da until) %arvo %b %wait until]
|
|
|
|
(send-raw-card card)
|
|
|
|
::
|
2019-09-27 20:40:22 +03:00
|
|
|
++ set-timeout
|
|
|
|
|* computation-result=mold
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,computation-result)
|
2019-09-27 20:40:22 +03:00
|
|
|
|= [time=@dr computation=form:m]
|
|
|
|
^- form:m
|
|
|
|
;< now=@da bind:m get-time
|
|
|
|
=/ when (add now time)
|
2019-11-19 07:36:21 +03:00
|
|
|
=/ =card:agent:gall
|
2019-09-27 20:40:22 +03:00
|
|
|
[%pass /timeout/(scot %da when) %arvo %b %wait when]
|
|
|
|
;< ~ bind:m (send-raw-card card)
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-27 20:40:22 +03:00
|
|
|
=* loop $
|
|
|
|
?: ?& ?=([~ %sign [%timeout @ ~] %b %wake *] in.tin)
|
|
|
|
=((scot %da when) i.t.wire.u.in.tin)
|
|
|
|
==
|
|
|
|
`[%fail %timeout ~]
|
|
|
|
=/ c-res (computation tin)
|
|
|
|
?: ?=(%cont -.next.c-res)
|
|
|
|
c-res(self.next ..loop(computation self.next.c-res))
|
|
|
|
?: ?=(%done -.next.c-res)
|
2019-11-19 07:36:21 +03:00
|
|
|
=/ =card:agent:gall
|
2019-09-27 20:40:22 +03:00
|
|
|
[%pass /timeout/(scot %da when) %arvo %b %rest when]
|
|
|
|
c-res(cards [card cards.c-res])
|
|
|
|
c-res
|
|
|
|
::
|
|
|
|
++ send-request
|
|
|
|
|= =request:http
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-09-27 20:40:22 +03:00
|
|
|
^- form:m
|
|
|
|
(send-raw-card %pass /request %arvo %i %request request *outbound-config:iris)
|
|
|
|
::
|
2019-10-11 01:30:24 +03:00
|
|
|
++ send-cancel-request
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-10-11 01:30:24 +03:00
|
|
|
^- form:m
|
|
|
|
(send-raw-card %pass /request %arvo %i %cancel-request ~)
|
|
|
|
::
|
2019-09-27 20:40:22 +03:00
|
|
|
++ take-client-response
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,client-response:iris)
|
2019-09-27 20:40:22 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-27 20:40:22 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
|
|
|
[~ %sign [%request ~] %i %http-response %finished *]
|
|
|
|
`[%done client-response.sign-arvo.u.in.tin]
|
|
|
|
==
|
|
|
|
::
|
2019-11-06 10:24:41 +03:00
|
|
|
:: Wait until we get an HTTP response or cancelation and unset contract
|
|
|
|
::
|
|
|
|
++ take-maybe-sigh
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,(unit httr:eyre))
|
2019-11-06 10:24:41 +03:00
|
|
|
^- form:m
|
|
|
|
;< rep=(unit client-response:iris) bind:m
|
|
|
|
take-maybe-response
|
|
|
|
?~ rep
|
|
|
|
(pure:m ~)
|
|
|
|
:: XX s/b impossible
|
|
|
|
::
|
|
|
|
?. ?=(%finished -.u.rep)
|
|
|
|
(pure:m ~)
|
|
|
|
(pure:m (some (to-httr:iris +.u.rep)))
|
|
|
|
::
|
2019-10-11 01:30:24 +03:00
|
|
|
++ take-maybe-response
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,(unit client-response:iris))
|
2019-10-11 01:30:24 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-10-11 01:30:24 +03:00
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
|
|
|
[~ %sign [%request ~] %i %http-response %cancel *]
|
|
|
|
`[%done ~]
|
|
|
|
[~ %sign [%request ~] %i %http-response %finished *]
|
|
|
|
`[%done `client-response.sign-arvo.u.in.tin]
|
|
|
|
==
|
|
|
|
::
|
2019-09-27 20:40:22 +03:00
|
|
|
++ extract-body
|
|
|
|
|= =client-response:iris
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,cord)
|
2019-09-27 20:40:22 +03:00
|
|
|
^- form:m
|
|
|
|
?> ?=(%finished -.client-response)
|
|
|
|
?> ?=(^ full-file.client-response)
|
|
|
|
(pure:m q.data.u.full-file.client-response)
|
|
|
|
::
|
|
|
|
++ fetch-json
|
|
|
|
|= url=tape
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,json)
|
2019-09-27 20:40:22 +03:00
|
|
|
^- form:m
|
|
|
|
=/ =request:http [%'GET' (crip url) ~ ~]
|
|
|
|
;< ~ bind:m (send-request request)
|
|
|
|
;< =client-response:iris bind:m take-client-response
|
|
|
|
;< =cord bind:m (extract-body client-response)
|
|
|
|
=/ json=(unit json) (de-json:html cord)
|
|
|
|
?~ json
|
2019-11-16 14:25:30 +03:00
|
|
|
(strand-fail %json-parse-error ~)
|
2019-09-27 20:40:22 +03:00
|
|
|
(pure:m u.json)
|
|
|
|
::
|
2019-11-26 08:30:41 +03:00
|
|
|
++ hiss-request
|
|
|
|
|= =hiss:eyre
|
|
|
|
=/ m (strand ,(unit httr:eyre))
|
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m (send-request (hiss-to-request:html hiss))
|
|
|
|
take-maybe-sigh
|
|
|
|
::
|
2020-03-21 01:30:24 +03:00
|
|
|
:: Run ford build
|
|
|
|
::
|
|
|
|
++ ford-build
|
|
|
|
|= =schematic:ford
|
|
|
|
=/ m (strand ,build-result:ford)
|
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m (send-raw-card %pass /ford-build %arvo %f %build | schematic)
|
|
|
|
;< =made-result:ford bind:m (take-made-result /ford-build)
|
|
|
|
?: ?=(%incomplete -.made-result)
|
|
|
|
(strand-fail %ford-incomplete tang.made-result)
|
|
|
|
(pure:m build-result.made-result)
|
|
|
|
::
|
|
|
|
:: Take ford build result
|
|
|
|
::
|
|
|
|
++ take-made-result
|
|
|
|
|= =wire
|
|
|
|
=/ m (strand ,made-result:ford)
|
|
|
|
^- form:m
|
|
|
|
|= tin=strand-input:strand
|
|
|
|
?+ in.tin `[%skip ~]
|
|
|
|
~ `[%wait ~]
|
|
|
|
[~ %sign * %f %made *]
|
|
|
|
?. =(wire wire.u.in.tin)
|
|
|
|
`[%skip ~]
|
|
|
|
`[%done result.sign-arvo.u.in.tin]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Run several taggged ford builds
|
|
|
|
::
|
|
|
|
++ build-map
|
2020-03-21 01:30:52 +03:00
|
|
|
|= builds=(map path schematic:ford)
|
|
|
|
=/ m (strand ,(map path build-result:ford))
|
2020-03-21 01:30:24 +03:00
|
|
|
^- form:m
|
|
|
|
=/ schematics=(list schematic:ford)
|
|
|
|
%+ turn ~(tap by builds)
|
2020-03-21 01:30:52 +03:00
|
|
|
|= [=path =schematic:ford]
|
|
|
|
[[%$ %noun !>(path)] schematic]
|
2020-03-21 01:30:24 +03:00
|
|
|
::
|
|
|
|
;< =build-result:ford bind:m (ford-build %list schematics)
|
|
|
|
?: ?=(%error -.build-result)
|
|
|
|
(strand-fail %ford-error message.build-result)
|
|
|
|
?> ?=(%list -.+.build-result)
|
|
|
|
::
|
2020-03-21 01:30:52 +03:00
|
|
|
=| produce=(map path build-result:ford)
|
2020-03-21 01:30:24 +03:00
|
|
|
|- ^- form:m
|
|
|
|
=* loop $
|
|
|
|
?^ results.build-result
|
|
|
|
?> ?=([[%success %$ %noun *] *] +.i.results.build-result)
|
|
|
|
=. produce
|
|
|
|
%+ ~(put by produce)
|
2020-03-21 01:30:52 +03:00
|
|
|
!<(path q.cage.head.i.results.build-result)
|
2020-03-21 01:30:24 +03:00
|
|
|
tail.i.results.build-result
|
|
|
|
loop(results.build-result t.results.build-result)
|
|
|
|
(pure:m produce)
|
|
|
|
::
|
2020-03-21 01:30:52 +03:00
|
|
|
:: Run several taggged ford builds
|
|
|
|
::
|
|
|
|
++ build-cages
|
|
|
|
|= builds=(map path schematic:ford)
|
|
|
|
=/ m (strand ,(map path cage))
|
|
|
|
^- form:m
|
|
|
|
;< result-map=(map path build-result:ford) bind:m (build-map builds)
|
|
|
|
=/ results=(list [=path =build-result:ford]) ~(tap by result-map)
|
|
|
|
=| produce=(map path cage)
|
|
|
|
|- ^- form:m
|
|
|
|
=* loop $
|
|
|
|
?^ results
|
|
|
|
?: ?=(%error -.build-result.i.results)
|
|
|
|
(strand-fail %ford-error message.build-result.i.results)
|
|
|
|
=. produce
|
|
|
|
%+ ~(put by produce) path.i.results
|
|
|
|
(result-to-cage:ford build-result.i.results)
|
|
|
|
loop(results t.results)
|
|
|
|
(pure:m produce)
|
|
|
|
::
|
2020-03-21 01:30:24 +03:00
|
|
|
:: Run ford %core build
|
|
|
|
::
|
|
|
|
++ build-core
|
|
|
|
|= =rail:ford
|
|
|
|
=/ m (strand ,vase)
|
|
|
|
^- form:m
|
|
|
|
;< =build-result:ford bind:m (ford-build %core rail)
|
|
|
|
?: ?=(%error -.build-result)
|
|
|
|
(strand-fail %ford-error message.build-result)
|
|
|
|
?> ?=(%core -.+.build-result)
|
|
|
|
(pure:m vase.build-result)
|
|
|
|
::
|
|
|
|
:: Run ford %core builds
|
|
|
|
::
|
|
|
|
++ build-cores
|
2020-03-21 01:30:52 +03:00
|
|
|
|= rails=(map path rail:ford)
|
|
|
|
=/ m (strand ,(map path vase))
|
2020-03-21 01:30:24 +03:00
|
|
|
^- form:m
|
|
|
|
=/ builds
|
|
|
|
%- ~(run by rails)
|
|
|
|
|= =rail:ford
|
|
|
|
[%core rail]
|
|
|
|
::
|
2020-03-21 01:30:52 +03:00
|
|
|
;< result-map=(map path build-result:ford) bind:m (build-map builds)
|
|
|
|
=/ results=(list [=path =build-result:ford]) ~(tap by result-map)
|
|
|
|
=| produce=(map path vase)
|
2020-03-21 01:30:24 +03:00
|
|
|
|- ^- form:m
|
|
|
|
=* loop $
|
|
|
|
?^ results
|
|
|
|
?: ?=(%error -.build-result.i.results)
|
|
|
|
(strand-fail %ford-error message.build-result.i.results)
|
|
|
|
?> ?=(%core -.+.build-result.i.results)
|
|
|
|
=. produce
|
2020-03-21 01:30:52 +03:00
|
|
|
(~(put by produce) path.i.results vase.build-result.i.results)
|
2020-03-21 01:30:24 +03:00
|
|
|
loop(results t.results)
|
|
|
|
(pure:m produce)
|
|
|
|
::
|
2019-09-26 08:43:14 +03:00
|
|
|
:: Queue on skip, try next on fail %ignore
|
|
|
|
::
|
|
|
|
++ main-loop
|
|
|
|
|* a=mold
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
|
|
|
=/ m-a (strand ,a)
|
|
|
|
=| queue=(qeu (unit input:strand))
|
|
|
|
=| active=(unit [in=(unit input:strand) =form:m-a forms=(list $-(a form:m-a))])
|
2019-09-27 20:40:22 +03:00
|
|
|
=| state=a
|
2019-09-29 07:44:31 +03:00
|
|
|
|= forms=(lest $-(a form:m-a))
|
2019-09-26 08:43:14 +03:00
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-26 08:43:14 +03:00
|
|
|
=* top `form:m`..$
|
|
|
|
=. queue (~(put to queue) in.tin)
|
|
|
|
|^ (continue bowl.tin)
|
|
|
|
::
|
|
|
|
++ continue
|
2019-11-16 14:25:30 +03:00
|
|
|
|= =bowl:strand
|
2019-09-26 08:43:14 +03:00
|
|
|
^- output:m
|
|
|
|
?> =(~ active)
|
|
|
|
?: =(~ queue)
|
|
|
|
`[%cont top]
|
2019-11-16 14:25:30 +03:00
|
|
|
=^ in=(unit input:strand) queue ~(get to queue)
|
2019-09-26 08:43:14 +03:00
|
|
|
^- output:m
|
2019-10-11 01:30:24 +03:00
|
|
|
=. active `[in (i.forms state) t.forms]
|
2019-09-26 08:43:14 +03:00
|
|
|
^- output:m
|
|
|
|
(run bowl in)
|
|
|
|
::
|
|
|
|
++ run
|
|
|
|
^- form:m
|
2019-11-16 14:25:30 +03:00
|
|
|
|= tin=strand-input:strand
|
2019-09-26 08:43:14 +03:00
|
|
|
^- output:m
|
|
|
|
?> ?=(^ active)
|
|
|
|
=/ res (form.u.active tin)
|
|
|
|
=/ =output:m
|
|
|
|
?- -.next.res
|
|
|
|
%wait `[%wait ~]
|
|
|
|
%skip `[%cont ..$(queue (~(put to queue) in.tin))]
|
2019-10-11 01:30:24 +03:00
|
|
|
%cont `[%cont ..$(active `[in.u.active self.next.res forms.u.active])]
|
2019-09-27 20:40:22 +03:00
|
|
|
%done (continue(active ~, state value.next.res) bowl.tin)
|
2019-09-26 08:43:14 +03:00
|
|
|
%fail
|
2019-09-29 07:44:31 +03:00
|
|
|
?: &(?=(^ forms.u.active) ?=(%ignore p.err.next.res))
|
2019-10-11 01:30:24 +03:00
|
|
|
%= $
|
|
|
|
active `[in.u.active (i.forms.u.active state) t.forms.u.active]
|
|
|
|
in.tin in.u.active
|
|
|
|
==
|
2019-09-26 08:43:14 +03:00
|
|
|
`[%fail err.next.res]
|
|
|
|
==
|
|
|
|
[(weld cards.res cards.output) next.output]
|
|
|
|
--
|
2019-11-06 10:24:41 +03:00
|
|
|
::
|
2019-11-12 08:36:32 +03:00
|
|
|
++ retry
|
|
|
|
|* result=mold
|
2019-11-16 14:25:30 +03:00
|
|
|
|= [crash-after=(unit @ud) computation=_*form:(strand (unit result))]
|
|
|
|
=/ m (strand ,result)
|
2019-11-12 08:36:32 +03:00
|
|
|
=| try=@ud
|
2019-11-14 07:00:56 +03:00
|
|
|
|- ^- form:m
|
|
|
|
=* loop $
|
|
|
|
?: =(crash-after `try)
|
2019-11-16 14:25:30 +03:00
|
|
|
(strand-fail %retry-too-many ~)
|
2019-11-14 07:00:56 +03:00
|
|
|
;< ~ bind:m (backoff try ~m1)
|
|
|
|
;< res=(unit result) bind:m computation
|
|
|
|
?^ res
|
|
|
|
(pure:m u.res)
|
|
|
|
loop(try +(try))
|
|
|
|
::
|
|
|
|
++ backoff
|
|
|
|
|= [try=@ud limit=@dr]
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-11-14 07:00:56 +03:00
|
|
|
^- form:m
|
|
|
|
;< eny=@uvJ bind:m get-entropy
|
|
|
|
%- sleep
|
|
|
|
%+ min limit
|
|
|
|
?: =(0 try) ~s0
|
|
|
|
%+ add
|
|
|
|
(mul ~s1 (bex (dec try)))
|
|
|
|
(mul ~s0..0001 (~(rad og eny) 1.000))
|
2019-11-06 10:24:41 +03:00
|
|
|
::
|
|
|
|
:: ----
|
|
|
|
::
|
|
|
|
:: Output
|
|
|
|
::
|
|
|
|
++ flog
|
|
|
|
|= =flog:dill
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-11-06 10:24:41 +03:00
|
|
|
^- form:m
|
|
|
|
(send-raw-card %pass / %arvo %d %flog flog)
|
|
|
|
::
|
|
|
|
++ flog-text
|
|
|
|
|= =tape
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-11-06 10:24:41 +03:00
|
|
|
^- form:m
|
|
|
|
(flog %text tape)
|
|
|
|
::
|
|
|
|
++ flog-tang
|
|
|
|
|= =tang
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-11-06 10:24:41 +03:00
|
|
|
^- form:m
|
|
|
|
=/ =wall
|
|
|
|
(zing (turn (flop tang) (cury wash [0 80])))
|
|
|
|
|- ^- form:m
|
|
|
|
=* loop $
|
|
|
|
?~ wall
|
|
|
|
(pure:m ~)
|
|
|
|
;< ~ bind:m (flog-text i.wall)
|
|
|
|
loop(wall t.wall)
|
|
|
|
::
|
2019-11-26 08:30:41 +03:00
|
|
|
++ app-message
|
|
|
|
|= [app=term =cord =tang]
|
|
|
|
=/ m (strand ,~)
|
|
|
|
^- form:m
|
|
|
|
=/ msg=tape :(weld (trip app) ": " (trip cord))
|
|
|
|
;< ~ bind:m (flog-text msg)
|
|
|
|
(flog-tang tang)
|
|
|
|
::
|
2019-11-06 10:24:41 +03:00
|
|
|
:: ----
|
|
|
|
::
|
|
|
|
:: Handle domains
|
|
|
|
::
|
|
|
|
++ install-domain
|
|
|
|
|= =turf
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,~)
|
2019-11-06 10:24:41 +03:00
|
|
|
^- form:m
|
|
|
|
(send-raw-card %pass / %arvo %e %rule %turf %put turf)
|
2019-11-15 00:31:44 +03:00
|
|
|
::
|
|
|
|
:: ----
|
|
|
|
::
|
2019-11-26 08:30:41 +03:00
|
|
|
:: Threads
|
2019-11-15 00:31:44 +03:00
|
|
|
::
|
2019-11-16 14:25:30 +03:00
|
|
|
++ start-thread
|
2019-11-15 00:31:44 +03:00
|
|
|
|= file=term
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ m (strand ,tid:spider)
|
2019-11-15 00:31:44 +03:00
|
|
|
^- form:m
|
|
|
|
;< =bowl:spider bind:m get-bowl
|
2019-11-16 14:25:30 +03:00
|
|
|
=/ tid (scot %ta (cat 3 'strand_' (scot %uv (sham file eny.bowl))))
|
|
|
|
=/ poke-vase !>([`tid.bowl `tid file *vase])
|
2019-11-15 00:31:44 +03:00
|
|
|
;< ~ bind:m (poke-our %spider %spider-start poke-vase)
|
2019-11-16 14:25:30 +03:00
|
|
|
;< ~ bind:m (sleep ~s0) :: wait for thread to start
|
|
|
|
(pure:m tid)
|
2019-11-22 23:46:30 +03:00
|
|
|
::
|
|
|
|
+$ thread-result
|
|
|
|
(each vase [term (list tang)])
|
|
|
|
::
|
|
|
|
++ await-thread
|
|
|
|
|= [file=term args=vase]
|
|
|
|
=/ m (strand ,thread-result)
|
|
|
|
^- form:m
|
|
|
|
;< =bowl:spider bind:m get-bowl
|
|
|
|
=/ tid (scot %ta (cat 3 'strand_' (scot %uv (sham file eny.bowl))))
|
|
|
|
=/ tid (scot %ta (cat 3 'strand_' (scot %uv (sham file eny.bowl))))
|
|
|
|
=/ poke-vase !>([`tid.bowl `tid file args])
|
|
|
|
;< ~ bind:m (watch-our /awaiting/[tid] %spider /thread-result/[tid])
|
|
|
|
;< ~ bind:m (poke-our %spider %spider-start poke-vase)
|
|
|
|
;< ~ bind:m (sleep ~s0) :: wait for thread to start
|
|
|
|
;< =cage bind:m (take-fact /awaiting/[tid])
|
|
|
|
?+ p.cage ~|([%strange-thread-result p.cage file tid] !!)
|
|
|
|
%thread-done (pure:m %& q.cage)
|
|
|
|
%thread-fail (pure:m %| !<([term (list tang)] q.cage))
|
|
|
|
==
|
2019-09-26 07:12:58 +03:00
|
|
|
--
|