mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
behn: improve scry interface
No longer abuse the desk field, instead making use of the path. Reject any scries outside of the local ship, empty desk and current time as invalid. Expose ducts only under a debug endpoint, nothing else should care about being able to inspect them. Add scry endpoints for the very next timer (if any), and all timers up to and including a specified timestamp.
This commit is contained in:
parent
f714d90b15
commit
a94285208a
@ -767,7 +767,7 @@
|
||||
++ v-behn
|
||||
|%
|
||||
++ timers
|
||||
(scry ,(list [date=@da =duct]) %b %timers ~)
|
||||
(scry ,(list [date=@da =duct]) %bx %$ /debug/timers)
|
||||
--
|
||||
::
|
||||
:: clay
|
||||
|
@ -1,5 +1,5 @@
|
||||
:: Find list of currently running Behn timers
|
||||
:- %say
|
||||
|= *
|
||||
|= [[now=@da *] *]
|
||||
:- %tang
|
||||
[>.^((list [date=@da =duct]) %b /=timers=)< ~]
|
||||
[>.^((list [date=@da =duct]) %bx /=//(scot %da now)/debug/timers)< ~]
|
||||
|
@ -389,18 +389,53 @@
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas why=shop syd=desk lot=coin tyl=path]
|
||||
^- (unit (unit cage))
|
||||
:: only respond for the local identity, %$ desk, current timestamp
|
||||
::
|
||||
?. ?=(%& -.why)
|
||||
?. ?& =(&+our why)
|
||||
=([%$ %da now] lot)
|
||||
=(%$ syd)
|
||||
==
|
||||
~
|
||||
?. ?=(%timers syd)
|
||||
[~ ~]
|
||||
=/ tiz=(list [@da duct])
|
||||
:: /bx/debug/timers (list [@da duct]) all timers and their ducts
|
||||
:: /bx/timers (list @da) all timer timestamps
|
||||
:: /bx/timers/next (unit @da) the very next timer to fire
|
||||
:: /bx/timers/[da] (list @da) all timers up to and including da
|
||||
::
|
||||
?. ?=(%x ren) ~
|
||||
?+ tyl [~ ~]
|
||||
[%debug %timers ~]
|
||||
:^ ~ ~ %noun
|
||||
!> ^- (list [@da duct])
|
||||
%- zing
|
||||
%+ turn (tap:timer-map timers)
|
||||
|= [date=@da q=(qeu duct)]
|
||||
%+ turn ~(tap to q)
|
||||
|=(d=duct [date d])
|
||||
[~ ~ %noun !>(tiz)]
|
||||
::
|
||||
[%timers ~]
|
||||
:^ ~ ~ %noun
|
||||
!> ^- (list @da)
|
||||
%- zing
|
||||
%+ turn (tap:timer-map timers)
|
||||
|= [date=@da q=(qeu duct)]
|
||||
(reap ~(wyt in q) date)
|
||||
::
|
||||
[%timers %next ~]
|
||||
:^ ~ ~ %noun
|
||||
!> ^- (unit @da)
|
||||
(bind (peek:timer-map timers) head)
|
||||
::
|
||||
[%timers @ ~]
|
||||
?~ til=(slaw %da i.t.tyl)
|
||||
[~ ~]
|
||||
:^ ~ ~ %noun
|
||||
!> ^- (list @da)
|
||||
%- zing
|
||||
%+ turn (tap:timer-map timers)
|
||||
|= [date=@da q=(qeu duct)]
|
||||
?: (gth date u.til) ~
|
||||
(reap ~(wyt in q) date)
|
||||
==
|
||||
::
|
||||
++ stay state
|
||||
++ take
|
||||
|
Loading…
Reference in New Issue
Block a user