mirror of
https://github.com/urbit/shrub.git
synced 2024-11-29 14:57:12 +03:00
Modified %mult to support past revisions, but with only a single case for all files.
This commit is contained in:
parent
5840c496c7
commit
70ad73e8ba
@ -275,10 +275,11 @@
|
|||||||
$% {$sing p/mood} :: single request
|
$% {$sing p/mood} :: single request
|
||||||
{$next p/mood q/(unit cach)} :: next version
|
{$next p/mood q/(unit cach)} :: next version
|
||||||
$: $mult :: next version of any
|
$: $mult :: next version of any
|
||||||
p/care ::
|
p/mool :: original request
|
||||||
q/(jug case spur) ::
|
q/(unit aeon) :: checking for change
|
||||||
r/(map case (map spur cach)) ::
|
r/(map spur (unit cach)) :: old version
|
||||||
== ::
|
s/(map spur (unit cach)) :: new version
|
||||||
|
==
|
||||||
{$many p/? q/moat r/(map path lobe)} :: change range
|
{$many p/? q/moat r/(map path lobe)} :: change range
|
||||||
== ::
|
== ::
|
||||||
::
|
::
|
||||||
@ -708,23 +709,13 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
$mult
|
$mult
|
||||||
=+ %+ roll ~(tap in q.rov)
|
?~ (case-to-aeon:ze q.p.rov) ~
|
||||||
|= {{c/case s/(set spur)} sus/(jug aeon spur) val/?}
|
|
||||||
?. val [~ |]
|
|
||||||
=+ a=(case-to-aeon:ze c)
|
|
||||||
?~ a [~ |]
|
|
||||||
[(~(put by sus) u.a s) &]
|
|
||||||
?. val ~
|
|
||||||
%+ skim ~(tap in ~(key by qyx))
|
%+ skim ~(tap in ~(key by qyx))
|
||||||
|= a=rove ^- ?
|
|= a=rove ^- ?
|
||||||
?. ?=($mult -.a) |
|
?& ?=($mult -.a)
|
||||||
?. =(~(wyt by q.a) ~(wyt by q.rov)) |
|
=(p.a p.rov(q q.p.a))
|
||||||
=- val %- ~(rep in q.a)
|
?=(^ (case-to-aeon:ze q.p.a))
|
||||||
|= {{c/case s/(set spur)} val/?}
|
==
|
||||||
?. val |
|
|
||||||
=+ a=(case-to-aeon:ze c)
|
|
||||||
?~ a |
|
|
||||||
=((~(get by sus) u.a) `s)
|
|
||||||
::
|
::
|
||||||
$many
|
$many
|
||||||
?~ (case-to-aeon:ze p.q.rov) ~
|
?~ (case-to-aeon:ze p.q.rov) ~
|
||||||
@ -849,28 +840,51 @@
|
|||||||
(blab hen p.rav u.u.new) :: changed
|
(blab hen p.rav u.u.new) :: changed
|
||||||
::
|
::
|
||||||
$mult
|
$mult
|
||||||
:: check to make sure that the request doesn't contain any historic or
|
=+ aey=(case-to-aeon:ze q.p.rav)
|
||||||
:: foreign targets.
|
:: if the requested case is in the future, we can't know anything yet.
|
||||||
?: %+ lien ~(tap by q.rav)
|
?~ aey (duce -.rav p.rav ~ ~ ~)
|
||||||
|= {c/case s/(set spur)}
|
=/ old
|
||||||
=+ (case-to-aeon:ze c)
|
%- ~(gas by *(map spur (unit cach)))
|
||||||
&(?=(^ -) (lth u.- let.dom))
|
%+ turn ~(tap by r.p.rav)
|
||||||
(blub hen)
|
|= s/spur
|
||||||
:: considering targets in the past are invalid, always store request.
|
^- (pair spur (unit cach))
|
||||||
=- (duce -.rav p.rav q.rav -)
|
[s (aver p.p.rav q.p.rav s)]
|
||||||
%- ~(gas by *(map case (map spur cach)))
|
=+ hav=|=({s/spur c/(unit cach)} ?=(^ c))
|
||||||
%+ turn ~(tap by q.rav)
|
=+ yon=+((need (case-to-aeon:ze q.p.rav)))
|
||||||
|= {c/case s/(set spur)}
|
|- ^+ +>.^$
|
||||||
^- (pair case (map spur cach))
|
:: if we're need future revisions to look for change, wait.
|
||||||
:- c
|
?: (gth yon let.dom)
|
||||||
=+ aey=(case-to-aeon:ze c)
|
(duce -.rav p.rav `yon old ~)
|
||||||
?~ aey ~ :: case in the future.
|
=/ new
|
||||||
%- ~(gas by *(map spur cach))
|
%- ~(gas by *(map spur (unit cach)))
|
||||||
%+ turn ~(tap in s)
|
%+ turn ~(tap by r.p.rav)
|
||||||
|= p/spur
|
|= s/spur
|
||||||
=+ (aver p.rav c p)
|
^- (pair spur (unit cach))
|
||||||
~| [%unexpected-async p.rav c p]
|
[s (aver p.p.rav q.p.rav s)]
|
||||||
?>(?=(^ -) [p u.-])
|
:: if we don't know everything now, store the request for later.
|
||||||
|
?. &((levy ~(tap by old) hav) (levy ~(tap by new) hav))
|
||||||
|
(duce -.rav p.rav `yon old new)
|
||||||
|
:: if we do know everything now, compare old and new.
|
||||||
|
:: if there are differences, send response. if not, try next aeon.
|
||||||
|
=; res
|
||||||
|
?~ res $(old new, yon +(yon))
|
||||||
|
(blas hen res)
|
||||||
|
%+ roll ~(tap by old)
|
||||||
|
|= $: {sup/spur ole/(unit cach)}
|
||||||
|
res/(map mood (each cage lobe))
|
||||||
|
==
|
||||||
|
=+ neu=(~(got by new) sup)
|
||||||
|
?< |(?=($~ ole) ?=($~ neu))
|
||||||
|
=- ?~(- res (~(put by res) u.-))
|
||||||
|
^- (unit (pair mood (each cage lobe)))
|
||||||
|
=+ mod=[p.p.rav [%ud yon] sup]
|
||||||
|
?~ u.ole
|
||||||
|
?~ u.neu ~ :: not added
|
||||||
|
`[mod u.u.neu] :: added
|
||||||
|
?~ u.neu
|
||||||
|
`[mod [%& %null [%atom %n ~] ~]] :: deleted
|
||||||
|
?: (equivalent-data:ze u.u.neu u.u.ole) ~ :: unchanged
|
||||||
|
`[mod u.u.neu] :: changed
|
||||||
::
|
::
|
||||||
$many
|
$many
|
||||||
=+ nab=(case-to-aeon:ze p.q.rav)
|
=+ nab=(case-to-aeon:ze p.q.rav)
|
||||||
@ -1705,7 +1719,7 @@
|
|||||||
?- -.rov
|
?- -.rov
|
||||||
$sing rov
|
$sing rov
|
||||||
$next [- p]:rov
|
$next [- p]:rov
|
||||||
$mult [- p q]:rov
|
$mult [- p]:rov
|
||||||
$many [- p q]:rov
|
$many [- p q]:rov
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
@ -1769,48 +1783,73 @@
|
|||||||
&+(blab-all q.i.xiq mod u.u.new) :: changed
|
&+(blab-all q.i.xiq mod u.u.new) :: changed
|
||||||
::
|
::
|
||||||
$mult
|
$mult
|
||||||
|
:: because %mult requests need to wait on multiple files for each
|
||||||
|
:: revision that needs to be checked for changes, we keep two cache maps.
|
||||||
|
:: {old} is the revision at {(dec yon)}, {new} is the revision at {yon}.
|
||||||
|
:: if we have no {yon} yet, that means it was still unknown last time
|
||||||
|
:: we checked.
|
||||||
=* rov p.i.xiq
|
=* rov p.i.xiq
|
||||||
=- ?^ res
|
=* mol p.rov
|
||||||
$(xiq t.xiq, ..wake (blas-all q.i.xiq res))
|
=* yon q.rov
|
||||||
$(xiq t.xiq, xaq [i.xiq(r.p (~(uni by r.rov) cac)) xaq])
|
=* old r.rov
|
||||||
%+ roll ~(tap by q.rov)
|
=* new s.rov
|
||||||
|= $: {cas/case sus/(set spur)}
|
:: we will either respond, or store the maybe updated request.
|
||||||
cac/(map case (map spur cach))
|
=; res/(each (map mood (each cage lobe)) rove)
|
||||||
|
?: ?=($& -.res)
|
||||||
|
$(xiq t.xiq, ..wake (blas-all q.i.xiq p.res))
|
||||||
|
$(xiq t.xiq, xaq [i.xiq(p p.res) xaq])
|
||||||
|
|- :: so that we can retry for the next aeon if possible/needed.
|
||||||
|
:: if we don't have an aeon yet, see if we have one now.
|
||||||
|
?~ yon
|
||||||
|
=+ aey=(case-to-aeon:ze q.mol)
|
||||||
|
:: if we still don't, wait.
|
||||||
|
?~ aey |+rov
|
||||||
|
:: if we do, update the request and retry.
|
||||||
|
$(rov [-.rov mol `+(u.aey) ~ ~])
|
||||||
|
=+ hav=|=({s/spur c/(unit cach)} ?=(^ c))
|
||||||
|
:: create a gate that tries to fill the unknown data into a cache map.
|
||||||
|
=/ fill
|
||||||
|
=/ d :: for easier iteraton.
|
||||||
|
%- ~(gas by *(map spur (unit cach)))
|
||||||
|
(turn ~(tap in r.mol) |=(s/spur [s ~]))
|
||||||
|
|= {m/(map spur (unit cach)) c/case}
|
||||||
|
%- ~(urn by ?~(m d m))
|
||||||
|
|= {s/spur o/(unit cach)}
|
||||||
|
?^(o o (aver p.mol c s))
|
||||||
|
:: if old isn't complete, try fillin in the gaps.
|
||||||
|
=? old |(?=($~ old) !(levy ~(tap by `(map spur (unit cach))`old) hav))
|
||||||
|
(fill old [%ud (dec u.yon)])
|
||||||
|
:: if the next aeon we want to compare is in the future, wait again.
|
||||||
|
=+ aey=(case-to-aeon:ze [%ud u.yon])
|
||||||
|
?~ aey |+rov
|
||||||
|
:: if new isn't complete, try filling in the gaps.
|
||||||
|
=? new |(?=($~ new) !(levy ~(tap by `(map spur (unit cach))`new) hav))
|
||||||
|
(fill new [%ud u.yon])
|
||||||
|
:: if they're still not both complete, wait again.
|
||||||
|
?. ?& (levy ~(tap by old) hav)
|
||||||
|
(levy ~(tap by new) hav)
|
||||||
|
==
|
||||||
|
|+rov
|
||||||
|
:: if there are any changes, send response. if none, move onto next aeon.
|
||||||
|
=; res
|
||||||
|
?^ res &+res
|
||||||
|
$(rov [-.rov mol `+(u.yon) new ~])
|
||||||
|
%+ roll ~(tap by old)
|
||||||
|
|= $: {sup/spur ole/(unit cach)}
|
||||||
res/(map mood (each cage lobe))
|
res/(map mood (each cage lobe))
|
||||||
==
|
==
|
||||||
^+ [cac res]
|
=+ neu=(~(got by new) sup)
|
||||||
=+ ole=(~(got by r.rov) cas)
|
?< |(?=($~ ole) ?=($~ neu))
|
||||||
:: if we don't have an existing cache, try to build it.
|
=- ?~(- res (~(put by res) u.-))
|
||||||
?~ ole
|
|
||||||
=- ?~ - [cac res]
|
|
||||||
[(~(put by cac) cas -) res]
|
|
||||||
=+ aey=(case-to-aeon:ze cas)
|
|
||||||
?~ aey ~ :: case in the future.
|
|
||||||
%- ~(gas by *(map spur cach))
|
|
||||||
%+ turn ~(tap in sus)
|
|
||||||
|= s/spur
|
|
||||||
^- (pair spur cach)
|
|
||||||
=+ (aver p.rov [%ud let.dom] s)
|
|
||||||
~| [%unexpected-async p.rov cas s]
|
|
||||||
?>(?=(^ -) [s u.-])
|
|
||||||
:: if we have an existing cache, compare it to current data.
|
|
||||||
:- cac
|
|
||||||
%- ~(gas by res)
|
|
||||||
%+ murn ~(tap in sus)
|
|
||||||
|= sup/spur
|
|
||||||
^- (unit (pair mood (each cage lobe)))
|
^- (unit (pair mood (each cage lobe)))
|
||||||
=+ old=(~(got by `(map spur cach)`ole) sup)
|
=+ mod=[p.mol [%ud u.yon] sup]
|
||||||
=+ new=(aver p.rov [%ud let.dom] sup)
|
?~ u.ole
|
||||||
~| [%unexpected-async p.rov let.dom sup]
|
?~ u.neu ~ :: not added
|
||||||
?> ?=(^ new)
|
`[mod u.u.neu] :: added
|
||||||
=+ mod=[p.rov [%ud let.dom] sup]
|
?~ u.neu
|
||||||
?~ old
|
|
||||||
?~ u.new ~ :: not added
|
|
||||||
`[mod u.u.new] :: added
|
|
||||||
?~ u.new
|
|
||||||
`[mod [%& %null [%atom %n ~] ~]] :: deleted
|
`[mod [%& %null [%atom %n ~] ~]] :: deleted
|
||||||
?: (equivalent-data:ze u.u.new u.old) ~ :: unchanged
|
?: (equivalent-data:ze u.u.neu u.u.ole) ~ :: unchanged
|
||||||
`[mod u.u.new] :: changed
|
`[mod u.u.neu] :: changed
|
||||||
::
|
::
|
||||||
$many
|
$many
|
||||||
=+ mot=`moat`q.p.i.xiq
|
=+ mot=`moat`q.p.i.xiq
|
||||||
|
@ -467,6 +467,7 @@
|
|||||||
++ moat {p/case q/case r/path} :: change range
|
++ moat {p/case q/case r/path} :: change range
|
||||||
++ mode (list {path (unit mime)}) :: external files
|
++ mode (list {path (unit mime)}) :: external files
|
||||||
++ mood {p/care q/case r/path} :: request in desk
|
++ mood {p/care q/case r/path} :: request in desk
|
||||||
|
++ mool {p/care q/case r/(set spur)} :: requests in desk
|
||||||
++ nori :: repository action
|
++ nori :: repository action
|
||||||
$% {$& p/soba} :: delta
|
$% {$& p/soba} :: delta
|
||||||
{$| p/@tas} :: label
|
{$| p/@tas} :: label
|
||||||
@ -489,7 +490,7 @@
|
|||||||
++ rave :: general request
|
++ rave :: general request
|
||||||
$% {$sing p/mood} :: single request
|
$% {$sing p/mood} :: single request
|
||||||
{$next p/mood} :: await next version
|
{$next p/mood} :: await next version
|
||||||
{$mult p/care q/(jug case spur)} :: next version of any
|
{$mult p/mool} :: next version of any
|
||||||
{$many p/? q/moat} :: track range
|
{$many p/? q/moat} :: track range
|
||||||
== ::
|
== ::
|
||||||
++ riff {p/desk q/(unit rave)} :: request+desist
|
++ riff {p/desk q/(unit rave)} :: request+desist
|
||||||
|
Loading…
Reference in New Issue
Block a user