mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-07 07:30:23 +03:00
pull-hook: add +take-update arm
This commit is contained in:
parent
4cb8339bf1
commit
2ce654555c
@ -48,4 +48,6 @@
|
|||||||
=/ maybe-time (peek-update-log:gra resource)
|
=/ maybe-time (peek-update-log:gra resource)
|
||||||
?~ maybe-time `/
|
?~ maybe-time `/
|
||||||
`/(scot %da u.maybe-time)
|
`/(scot %da u.maybe-time)
|
||||||
|
::
|
||||||
|
++ take-update take-update:dep
|
||||||
--
|
--
|
||||||
|
@ -49,4 +49,6 @@
|
|||||||
|= =resource
|
|= =resource
|
||||||
^- (unit path)
|
^- (unit path)
|
||||||
`/
|
`/
|
||||||
|
::
|
||||||
|
++ take-update take-update:dep
|
||||||
--
|
--
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
%metadata-push-hook
|
%metadata-push-hook
|
||||||
==
|
==
|
||||||
+$ state-zero
|
+$ state-zero
|
||||||
[%0 previews=(map resource group-preview)]
|
[%0 ~]
|
||||||
::
|
::
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
@ -31,14 +31,11 @@
|
|||||||
=* state -
|
=* state -
|
||||||
=> |_ =bowl:gall
|
=> |_ =bowl:gall
|
||||||
++ def ~(. (default-agent state %|) bowl)
|
++ def ~(. (default-agent state %|) bowl)
|
||||||
++ watch-preview
|
++ add-resource
|
||||||
|= rid=resource
|
|= rid=resource
|
||||||
^- card
|
^- card
|
||||||
=/ =path
|
=- [%pass / %agent [our dap]:bowl %poke -]
|
||||||
preview+(en-path:resource rid)
|
pull-hook-action+!>(`action:pull-hook`[%add [entity .]:rid])
|
||||||
=/ =dock
|
|
||||||
[entity.rid %metadata-push-hook]
|
|
||||||
[%pass path %agent dock %watch path]
|
|
||||||
::
|
::
|
||||||
++ watch-invites
|
++ watch-invites
|
||||||
^- card
|
^- card
|
||||||
@ -54,40 +51,17 @@
|
|||||||
:_ state
|
:_ state
|
||||||
?. ?=(%invite -.update) ~
|
?. ?=(%invite -.update) ~
|
||||||
?. =(%contacts term.update) ~
|
?. =(%contacts term.update) ~
|
||||||
(watch-preview resource.invite.update)^~
|
(add-resource resource.invite.update)^~
|
||||||
::
|
::
|
||||||
%kick [watch-invites^~ state]
|
%kick [watch-invites^~ state]
|
||||||
==
|
==
|
||||||
::
|
|
||||||
++ take-preview
|
|
||||||
|= [=wire =sign:agent:gall]
|
|
||||||
^- (quip card _state)
|
|
||||||
?> ?=([%preview @ *] wire)
|
|
||||||
=/ rid=resource
|
|
||||||
(de-path:resource t.wire)
|
|
||||||
?+ -.sign (on-agent:def wire sign)
|
|
||||||
%fact
|
|
||||||
?> =(%metadata-update p.cage.sign)
|
|
||||||
=+ !<(upd=metadata-update q.cage.sign)
|
|
||||||
?> ?=(%preview -.upd)
|
|
||||||
:_ state(previews (~(put by previews) rid +.upd))
|
|
||||||
:~ [%give %fact ~[wire] cage.sign]
|
|
||||||
[%give %kick ~[wire] ~]
|
|
||||||
==
|
|
||||||
::
|
|
||||||
%watch-ack
|
|
||||||
:_ state
|
|
||||||
?~ p.sign ~
|
|
||||||
:~ [%give %fact ~[wire] tang+!>(u.p.sign)]
|
|
||||||
[%give %kick ~[wire] ~]
|
|
||||||
==
|
|
||||||
==
|
|
||||||
--
|
--
|
||||||
|_ =bowl:gall
|
|_ =bowl:gall
|
||||||
+* this .
|
+* this .
|
||||||
def ~(. (default-agent this %|) bowl)
|
def ~(. (default-agent this %|) bowl)
|
||||||
dep ~(. (default:pull-hook this config) bowl)
|
dep ~(. (default:pull-hook this config) bowl)
|
||||||
met ~(. mdl bowl)
|
met ~(. mdl bowl)
|
||||||
|
grp ~(. grpl bowl)
|
||||||
hc ~(. +> bowl)
|
hc ~(. +> bowl)
|
||||||
::
|
::
|
||||||
++ on-init on-init:def
|
++ on-init on-init:def
|
||||||
@ -106,7 +80,6 @@
|
|||||||
=^ cards state
|
=^ cards state
|
||||||
?+ wire (on-agent:def:hc wire sign)
|
?+ wire (on-agent:def:hc wire sign)
|
||||||
[%invites ~] (take-invites:hc sign)
|
[%invites ~] (take-invites:hc sign)
|
||||||
[%preview @ @ @ ~] (take-preview:hc wire sign)
|
|
||||||
==
|
==
|
||||||
[cards this]
|
[cards this]
|
||||||
::
|
::
|
||||||
@ -117,8 +90,7 @@
|
|||||||
(on-watch:def path)
|
(on-watch:def path)
|
||||||
=/ rid=resource
|
=/ rid=resource
|
||||||
(de-path:resource t.path)
|
(de-path:resource t.path)
|
||||||
=/ prev=(unit group-preview)
|
=/ prev=(unit group-preview) ~
|
||||||
(~(get by previews) rid)
|
|
||||||
:_ this
|
:_ this
|
||||||
?^ prev
|
?^ prev
|
||||||
:~ [%give %fact ~ metadata-update+!>([%preview u.prev])]
|
:~ [%give %fact ~ metadata-update+!>([%preview u.prev])]
|
||||||
@ -147,7 +119,12 @@
|
|||||||
[%remove resource md-resource]
|
[%remove resource md-resource]
|
||||||
::
|
::
|
||||||
++ on-pull-kick
|
++ on-pull-kick
|
||||||
|= =resource
|
|= rid=resource
|
||||||
^- (unit path)
|
^- (unit path)
|
||||||
|
?. (is-member:grp our.bowl rid) ~
|
||||||
`/
|
`/
|
||||||
|
::
|
||||||
|
++ take-update
|
||||||
|
|= [rid=resource =vase]
|
||||||
|
`this
|
||||||
--
|
--
|
||||||
|
@ -76,6 +76,10 @@
|
|||||||
%- (slog tank tang)
|
%- (slog tank tang)
|
||||||
[~ pull-hook]
|
[~ pull-hook]
|
||||||
::
|
::
|
||||||
|
++ take-update
|
||||||
|
|= [=resource =vase]
|
||||||
|
`pull-hook
|
||||||
|
::
|
||||||
++ on-pull-kick
|
++ on-pull-kick
|
||||||
|= =resource
|
|= =resource
|
||||||
*(unit path)
|
*(unit path)
|
||||||
@ -106,6 +110,12 @@
|
|||||||
++ on-pull-kick
|
++ on-pull-kick
|
||||||
|~ resource
|
|~ resource
|
||||||
*(unit path)
|
*(unit path)
|
||||||
|
:: +take-update: process store update
|
||||||
|
::
|
||||||
|
:: Perform actions before the store receives the update
|
||||||
|
++ take-update
|
||||||
|
|~ [resource vase]
|
||||||
|
*[(list card) _^|(..on-init)]
|
||||||
::
|
::
|
||||||
:: from agent:gall
|
:: from agent:gall
|
||||||
++ on-init
|
++ on-init
|
||||||
@ -292,8 +302,10 @@
|
|||||||
=^ cards pull-hook
|
=^ cards pull-hook
|
||||||
(on-agent:og wire sign)
|
(on-agent:og wire sign)
|
||||||
[cards this]
|
[cards this]
|
||||||
|
=^ cards pull-hook
|
||||||
|
(take-update:og rid q.cage.sign)
|
||||||
:_ this
|
:_ this
|
||||||
~[(update-store:hc rid q.cage.sign)]
|
(snoc cards (update-store:hc rid q.cage.sign))
|
||||||
==
|
==
|
||||||
++ on-leave
|
++ on-leave
|
||||||
|= =path
|
|= =path
|
||||||
|
Loading…
Reference in New Issue
Block a user