mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 14:42:02 +03:00
Merge branch 'la/ordered-map-subset' into la/graph-store
This commit is contained in:
commit
106119a9ba
@ -31,7 +31,7 @@ Urbit uses [Nix][nix] to manage builds. On Linux and macOS you can install Nix
|
||||
via:
|
||||
|
||||
```
|
||||
curl https://nixos.org/nix/install | sh
|
||||
curl -L https://nixos.org/nix/install | sh
|
||||
```
|
||||
|
||||
The Makefile in the project's root directory contains useful phony targets for
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:581c9b713aa12126f3a618d75bf4254bb431f633fbfc76941663391d3d13cdb0
|
||||
size 16742515
|
||||
oid sha256:6614c1334e3e27722a31e0ae41cfda9b5e1915d5fe75daa3a0ec8423a9574bc6
|
||||
size 16649737
|
||||
|
@ -41,37 +41,11 @@
|
||||
^- (quip card _this)
|
||||
|^
|
||||
=/ old !<(versioned-state old-vase)
|
||||
=| cards=(list card)
|
||||
|-
|
||||
^- (quip card _this)
|
||||
?- -.old
|
||||
%3 [cards this(state old)]
|
||||
::
|
||||
%2
|
||||
=/ =inbox:store
|
||||
(migrate-path-map:group-store inbox.old)
|
||||
=/ kick-paths
|
||||
%~ tap in
|
||||
%+ roll
|
||||
~(val by sup.bowl)
|
||||
|= [[=ship sub=path] subs=(set path)]
|
||||
^- (set path)
|
||||
?. ?=([@ @ *] sub)
|
||||
subs
|
||||
?. &(=(%mailbox i.sub) =('~' i.t.sub))
|
||||
subs
|
||||
(~(put in subs) sub)
|
||||
=? cards ?=(^ kick-paths)
|
||||
:_ cards
|
||||
[%give %kick kick-paths ~]
|
||||
=. cards
|
||||
:_ cards
|
||||
[%pass /trim %agent [our.bowl %chat-store] %poke %noun !>([%trim ~])]
|
||||
$(old [%3 inbox.old])
|
||||
::
|
||||
?(%0 %1) $(old (old-to-2 inbox.old))
|
||||
::
|
||||
==
|
||||
=? old ?=(%0 -.old)
|
||||
(old-to-2 inbox.old)
|
||||
=? old ?=(%1 -.old)
|
||||
(old-to-2 inbox.old)
|
||||
[~ this(state [%2 inbox.old])]
|
||||
::
|
||||
++ old-to-2
|
||||
|= =inbox:store
|
||||
@ -265,9 +239,6 @@
|
||||
=. letter.envelope.action (evaluate-letter [author letter]:envelope.action)
|
||||
=^ envelope u.mailbox (prepend-envelope u.mailbox envelope.action)
|
||||
:_ state(inbox (~(put by inbox) path.action u.mailbox))
|
||||
?: =((mod number.envelope 5.000) 0)
|
||||
:- [%pass /trim %agent [our.bol %chat-store] %poke %noun !>([%trim ~])]
|
||||
(send-diff path.action action(envelope envelope))
|
||||
(send-diff path.action action(envelope envelope))
|
||||
::
|
||||
++ handle-messages
|
||||
@ -283,7 +254,6 @@
|
||||
|- ^- (quip card _state)
|
||||
?~ envelopes.act
|
||||
:_ state(inbox (~(put by inbox) path.act u.mailbox))
|
||||
:- [%pass /trim %agent [our.bol %chat-store] %poke %noun !>([%trim ~])]
|
||||
%+ send-diff path.act
|
||||
[%messages path.act 0 (lent evaluated-envelopes) evaluated-envelopes]
|
||||
=. letter.i.envelopes.act (evaluate-letter [author letter]:i.envelopes.act)
|
||||
|
@ -39,7 +39,14 @@
|
||||
[d this]
|
||||
::
|
||||
++ on-leave on-leave:def
|
||||
++ on-peek on-peek:def
|
||||
++ on-peek
|
||||
|= =path
|
||||
~& peeking=path
|
||||
^- (unit (unit cage))
|
||||
?+ path (on-peek:def path)
|
||||
[* %kiln *] (on-peek:kiln-core path)
|
||||
==
|
||||
::
|
||||
++ on-save !>(state)
|
||||
++ on-load
|
||||
|= =old-state=vase
|
||||
|
File diff suppressed because one or more lines are too long
@ -43,7 +43,12 @@
|
||||
==
|
||||
::
|
||||
++ base-hash
|
||||
=/ parent (scot %p (sein:title our now our))
|
||||
=+ .^(=cass:clay %cs /[parent]/kids/1/late/foo)
|
||||
.^(@uv %cz /[parent]/kids/(scot %ud ud.cass))
|
||||
=+ .^ ota=(unit [=ship =desk =aeon:clay])
|
||||
%gx /(scot %p our)/hood/(scot %da now)/kiln/ota/noun
|
||||
==
|
||||
?~ ota
|
||||
*@uv
|
||||
=/ parent (scot %p ship.u.ota)
|
||||
=+ .^(=cass:clay %cs /[parent]/[desk.u.ota]/1/late/foo)
|
||||
.^(@uv %cz /[parent]/[desk.u.ota]/(scot %ud ud.cass))
|
||||
--
|
||||
|
@ -104,6 +104,13 @@
|
||||
=. +<+.$.abet old
|
||||
..abet
|
||||
::
|
||||
++ on-peek
|
||||
|= =path
|
||||
^- (unit (unit cage))
|
||||
?. ?=([%x %kiln %ota ~] path)
|
||||
[~ ~]
|
||||
``noun+!>(ota)
|
||||
::
|
||||
++ poke-commit
|
||||
|= [mon/kiln-commit auto=?]
|
||||
=< abet
|
||||
@ -342,7 +349,7 @@
|
||||
"OTAs disabled"
|
||||
"OTAs from {<desk.u.ota>} on {<ship.u.ota>}"
|
||||
?: =(0 ~(wyt by syn))
|
||||
[%leaf "no syncs configured"]~
|
||||
[%leaf "no other syncs configured"]~
|
||||
%+ turn ~(tap in ~(key by syn))
|
||||
|=(a/kiln-sync (render "sync configured" [sud her syd]:a))
|
||||
::
|
||||
|
@ -2366,7 +2366,8 @@
|
||||
|= [pax=path *]
|
||||
=((~(got by new.dal) pax) (~(got by new.dob) pax))
|
||||
?: &(?=(%mate germ) ?=(^ con))
|
||||
[%| %mate-conflict ~]
|
||||
=+ (turn ~(tap by `(map path *)`con) |=([path *] >[+<-]<))
|
||||
[%| %mate-conflict -]
|
||||
=/ old=(map path lobe) :: oldies but goodies
|
||||
%+ roll ~(tap by (~(uni by old.dal) old.dob))
|
||||
=< .(old q.bas)
|
||||
|
@ -807,21 +807,33 @@
|
||||
=/ cag=cage (need (need ski))
|
||||
?> =(%vase p.cag)
|
||||
=/ gat=vase !<(vase q.cag)
|
||||
=/ res=(each vase tang)
|
||||
%- mule |.
|
||||
=/ res=toon
|
||||
%- mock :_ (sloy scry)
|
||||
:_ [%9 2 %0 1] |.
|
||||
%+ slam
|
||||
%+ slam gat
|
||||
!>([now=now eny=eny bek=bek])
|
||||
!>([[now=now eny=eny bek=bek] ~ ~])
|
||||
!>([authenticated request])
|
||||
?: ?=(%| -.res)
|
||||
?: ?=(%2 -.res)
|
||||
=+ connection=(~(got by connections.state) duct)
|
||||
%^ return-static-data-on-duct 500 'text/html'
|
||||
%: internal-server-error
|
||||
authenticated.inbound-request.connection
|
||||
url.request.inbound-request.connection
|
||||
leaf+"generator crashed"
|
||||
p.res
|
||||
==
|
||||
=/ result !<(simple-payload:http p.res)
|
||||
?: ?=(%1 -.res)
|
||||
=+ connection=(~(got by connections.state) duct)
|
||||
%^ return-static-data-on-duct 500 'text/html'
|
||||
%: internal-server-error
|
||||
authenticated.inbound-request.connection
|
||||
url.request.inbound-request.connection
|
||||
leaf+"scry blocked on"
|
||||
>p.res<
|
||||
~
|
||||
==
|
||||
=/ result ;;(simple-payload:http +.p.res)
|
||||
:: ensure we have a valid content-length header
|
||||
::
|
||||
:: We pass on the response and the headers the generator produces, but
|
||||
|
@ -869,9 +869,17 @@
|
||||
?=(%rift -.a-diff)
|
||||
(gth to.a-diff rift.point)
|
||||
==
|
||||
%+ public-keys-give
|
||||
(subscribers-on-ship who)
|
||||
[%breach who]
|
||||
=. ..feel
|
||||
%+ public-keys-give
|
||||
(subscribers-on-ship who)
|
||||
[%breach who]
|
||||
=/ sor (~(get by sources-reverse) %& who)
|
||||
?~ sor
|
||||
..feel
|
||||
:: delay resubscribing because Ames is going to clear any
|
||||
:: messages we send now.
|
||||
::
|
||||
(emit hen %pass /breach/(scot %ud u.sor) %b %wait now)
|
||||
::
|
||||
=. point
|
||||
?- -.a-diff
|
||||
|
@ -7070,6 +7070,15 @@
|
||||
$(pops [oldest pops])
|
||||
--
|
||||
--
|
||||
::
|
||||
++ mop
|
||||
|* [key=mold value=mold]
|
||||
|= ord=$-([key key] ?)
|
||||
|= a=*
|
||||
=/ b ;;((tree [key=key val=value]) a)
|
||||
?> (check-balance:((ordered-map key value) ord) b)
|
||||
b
|
||||
::
|
||||
:: $mk-item: constructor for +ordered-map item type
|
||||
::
|
||||
++ mk-item |$ [key val] [key=key val=val]
|
||||
@ -7151,6 +7160,7 @@
|
||||
?~ a ~
|
||||
?~ l.a `n.a
|
||||
$(a l.a)
|
||||
::
|
||||
:: +pop: produce .head (smallest item) and .rest or crash if empty
|
||||
::
|
||||
++ pop
|
||||
@ -7317,6 +7327,68 @@
|
||||
?: (compare key.n.a key.n.b)
|
||||
$(l.b $(b l.b, r.a ~), a r.a)
|
||||
$(r.b $(b r.b, l.a ~), a l.a)
|
||||
::
|
||||
:: +get: get val at key or return ~
|
||||
::
|
||||
++ get
|
||||
|= [a=(tree item) b=key]
|
||||
^- (unit val)
|
||||
?~ a ~
|
||||
?: =(b key.n.a)
|
||||
`val.n.a
|
||||
?: (compare b key.n.a)
|
||||
$(a l.a)
|
||||
$(a r.a)
|
||||
::
|
||||
:: +subset: take a range excluding start and/or end and all elements
|
||||
:: outside the range
|
||||
::
|
||||
++ subset
|
||||
|= $: tre=(tree item)
|
||||
start=(unit key)
|
||||
end=(unit key)
|
||||
==
|
||||
^- (tree item)
|
||||
|^
|
||||
?: ?&(?=(~ start) ?=(~ end))
|
||||
tre
|
||||
?~ start
|
||||
(del-span tre %end end)
|
||||
?~ end
|
||||
(del-span tre %start start)
|
||||
?> (compare u.start u.end)
|
||||
=. tre (del-span tre %start start)
|
||||
(del-span tre %end end)
|
||||
::
|
||||
++ del-span
|
||||
|= [a=(tree item) b=?(%start %end) c=(unit key)]
|
||||
^- (tree item)
|
||||
?~ a a
|
||||
?~ c a
|
||||
?- b
|
||||
%start
|
||||
:: found key
|
||||
?: =(key.n.a u.c)
|
||||
(nip a(l ~))
|
||||
:: traverse to find key
|
||||
?: (compare key.n.a u.c)
|
||||
:: found key to the left of start
|
||||
$(a (nip a(l ~)))
|
||||
:: found key to the right of start
|
||||
a(l $(a l.a))
|
||||
::
|
||||
%end
|
||||
:: found key
|
||||
?: =(u.c key.n.a)
|
||||
(nip a(r ~))
|
||||
:: traverse to find key
|
||||
?: (compare key.n.a u.c)
|
||||
:: found key to the left of end
|
||||
a(r $(a r.a))
|
||||
:: found key to the right of end
|
||||
$(a (nip a(r ~)))
|
||||
==
|
||||
--
|
||||
--
|
||||
:: ::
|
||||
:::: ++userlib :: (2u) non-vane utils
|
||||
|
@ -1,8 +1,4 @@
|
||||
:: TODO: move +ordered-map to zuse
|
||||
::
|
||||
/+ *test
|
||||
/= ames /sys/vane/ames
|
||||
::
|
||||
=/ items-from-keys
|
||||
|= keys=(list @ud)
|
||||
%+ turn keys
|
||||
@ -12,7 +8,7 @@
|
||||
=/ test-items=(list [@ud @tas])
|
||||
(items-from-keys (gulf 0 6))
|
||||
::
|
||||
=/ atom-map ((ordered-map:ames @ud @tas) lte)
|
||||
=/ atom-map ((ordered-map @ud @tas) lte)
|
||||
::
|
||||
|%
|
||||
++ test-ordered-map-gas ^- tang
|
||||
@ -57,6 +53,56 @@
|
||||
!> (gas:atom-map ~ ~[[0^%a] [1^%b] [2^%c] [3^%d] [4^%e] [5^%f]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-subset ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
=/ b (subset:atom-map a `0 `4)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (gas:atom-map ~ ~[[1^%b] [2^%c] [3^%d]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-null-start-subset ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
=/ b (subset:atom-map a ~ `5)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (gas:atom-map ~ ~[[0^%a] [1^%b] [2^%c] [3^%d] [4^%e]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-null-end-subset ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
=/ b (subset:atom-map a `1 ~)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (gas:atom-map ~ ~[[2^%c] [3^%d] [4^%e] [5^%f] [6^%g]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-double-null-subset ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
::
|
||||
=/ b (subset:atom-map a ~ ~)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (gas:atom-map ~ ~[[0^%a] [1^%b] [2^%c] [3^%d] [4^%e] [5^%f] [6^%g]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-not-found-start-subset ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ ~[[1^%b]])
|
||||
::
|
||||
=/ b (subset:atom-map a `0 ~)
|
||||
::
|
||||
%+ expect-eq
|
||||
!> (gas:atom-map ~ ~[[1^%b]])
|
||||
!> b
|
||||
::
|
||||
++ test-ordered-map-traverse ^- tang
|
||||
::
|
||||
=/ a=(tree [@ud @tas]) (gas:atom-map ~ test-items)
|
||||
|
@ -19,31 +19,26 @@ export class OverlaySigil extends Component {
|
||||
|
||||
this.profileShow = this.profileShow.bind(this);
|
||||
this.profileHide = this.profileHide.bind(this);
|
||||
this.updateContainerInterval = null;
|
||||
}
|
||||
|
||||
profileShow() {
|
||||
this.updateContainerOffset();
|
||||
this.setState({ profileClicked: true });
|
||||
this.updateContainerInterval = setInterval(
|
||||
this.updateContainerOffset.bind(this),
|
||||
1000
|
||||
);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.updateContainerOffset();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.updateContainerInterval) {
|
||||
profileHide() {
|
||||
this.setState({ profileClicked: false });
|
||||
if(this.updateContainerInterval) {
|
||||
clearInterval(this.updateContainerInterval);
|
||||
this.updateContainerInterval = null;
|
||||
}
|
||||
}
|
||||
|
||||
profileShow() {
|
||||
this.setState({ profileClicked: true });
|
||||
}
|
||||
|
||||
profileHide() {
|
||||
this.setState({ profileClicked: false });
|
||||
}
|
||||
|
||||
updateContainerOffset() {
|
||||
if (this.containerRef && this.containerRef.current) {
|
||||
const parent = this.containerRef.current.offsetParent;
|
||||
|
Loading…
Reference in New Issue
Block a user