mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-26 08:25:04 +03:00
add +scry to lib/stdio
This commit is contained in:
parent
f0b38e748a
commit
6349fc85ee
@ -62,6 +62,25 @@
|
|||||||
::
|
::
|
||||||
:: ----
|
:: ----
|
||||||
::
|
::
|
||||||
|
:: Scry from the namespace.
|
||||||
|
::
|
||||||
|
:: Direct scrys are impossible in a tapp, so this routes around that.
|
||||||
|
::
|
||||||
|
++ scry
|
||||||
|
|* result-type=mold
|
||||||
|
|= =path
|
||||||
|
=/ m (async ,result-type)
|
||||||
|
;< ~ bind:m (send-raw-card %scry path)
|
||||||
|
|= =async-input
|
||||||
|
:^ ~ ~ ~
|
||||||
|
?~ in.async-input
|
||||||
|
[%wait ~]
|
||||||
|
?. ?=(%scry-result -.sign.u.in.async-input)
|
||||||
|
[%fail %expected-scry-result >got=-.sign< ~]
|
||||||
|
[%done (result-type result.sign.u.in.async-input)]
|
||||||
|
::
|
||||||
|
:: ----
|
||||||
|
::
|
||||||
:: Outgoing HTTP requests
|
:: Outgoing HTTP requests
|
||||||
::
|
::
|
||||||
++ send-request
|
++ send-request
|
||||||
|
@ -428,6 +428,9 @@
|
|||||||
|= =async-input:async-lib
|
|= =async-input:async-lib
|
||||||
^- (quip move _this-tapp)
|
^- (quip move _this-tapp)
|
||||||
=/ m tapp-async
|
=/ m tapp-async
|
||||||
|
=| moves=(list move)
|
||||||
|
=| scrys=(list path)
|
||||||
|
|- ^- (quip move _this-tapp)
|
||||||
?~ active
|
?~ active
|
||||||
~| %no-active-async
|
~| %no-active-async
|
||||||
~| ?~ in.async-input
|
~| ?~ in.async-input
|
||||||
@ -442,14 +445,27 @@
|
|||||||
%& p.out
|
%& p.out
|
||||||
%| [[~ [%fail contracts.u.active %crash p.out]] u.active]
|
%| [[~ [%fail contracts.u.active %crash p.out]] u.active]
|
||||||
==
|
==
|
||||||
|
=. moves (weld moves (skip moves.r |=(=move =(%scry -.q.move))))
|
||||||
|
=. scrys
|
||||||
|
%+ weld scrys
|
||||||
|
^- (list path)
|
||||||
|
%+ murn moves.r
|
||||||
|
|= =move
|
||||||
|
^- (unit path)
|
||||||
|
?. ?=(%scry -.q.move)
|
||||||
|
~
|
||||||
|
`path.q.move
|
||||||
|
?^ scrys
|
||||||
|
=/ scry-result .^(* i.scrys)
|
||||||
|
$(scrys t.scrys, in.async-input `[i.scrys %scry-result scry-result])
|
||||||
=> .(active `(unit eval-form:eval:tapp-async)`active) :: TMI
|
=> .(active `(unit eval-form:eval:tapp-async)`active) :: TMI
|
||||||
=^ moves=(list move) this-tapp
|
=^ final-moves=(list move) this-tapp
|
||||||
?- -.eval-result.r
|
?- -.eval-result.r
|
||||||
%next `this-tapp
|
%next `this-tapp
|
||||||
%fail (fail-async [contracts err]:eval-result.r)
|
%fail (fail-async [contracts err]:eval-result.r)
|
||||||
%done (done-async [contracts value]:eval-result.r)
|
%done (done-async [contracts value]:eval-result.r)
|
||||||
==
|
==
|
||||||
[(weld moves.r moves) this-tapp]
|
[(weld moves final-moves) this-tapp]
|
||||||
::
|
::
|
||||||
:: Fails currently-running async
|
:: Fails currently-running async
|
||||||
::
|
::
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
:: Possible async calls
|
:: Possible async calls
|
||||||
::
|
::
|
||||||
+$ card
|
+$ card
|
||||||
$% [%wait wire @da]
|
$% [%scry =path]
|
||||||
|
[%wait wire @da]
|
||||||
[%rest wire @da]
|
[%rest wire @da]
|
||||||
[%poke wire dock poke-data]
|
[%poke wire dock poke-data]
|
||||||
[%peer wire dock path]
|
[%peer wire dock path]
|
||||||
@ -24,7 +25,8 @@
|
|||||||
:: Possible async responses
|
:: Possible async responses
|
||||||
::
|
::
|
||||||
+$ sign
|
+$ sign
|
||||||
$% [%wake error=(unit tang)]
|
$% [%scry-result result=*]
|
||||||
|
[%wake error=(unit tang)]
|
||||||
[%coup =dock error=(unit tang)]
|
[%coup =dock error=(unit tang)]
|
||||||
[%quit =dock =path]
|
[%quit =dock =path]
|
||||||
[%reap =dock =path error=(unit tang)]
|
[%reap =dock =path error=(unit tang)]
|
||||||
|
Loading…
Reference in New Issue
Block a user