2021-01-29 07:52:36 +03:00
|
|
|
/- view-sur=group-view, group-store, *group, metadata=metadata-store
|
2021-01-29 07:21:13 +03:00
|
|
|
/+ default-agent, agentio, mdl=metadata, resource, dbug, grpl=group, verb
|
2021-01-12 02:05:39 +03:00
|
|
|
|%
|
|
|
|
++ card card:agent:gall
|
|
|
|
+$ state-zero
|
|
|
|
$: %0
|
2021-01-29 07:21:13 +03:00
|
|
|
joining=(map rid=resource =ship)
|
2021-01-12 02:05:39 +03:00
|
|
|
==
|
2021-01-29 07:21:13 +03:00
|
|
|
++ view view-sur
|
2021-01-12 02:05:39 +03:00
|
|
|
--
|
|
|
|
=| state-zero
|
|
|
|
=* state -
|
|
|
|
::
|
|
|
|
%- agent:dbug
|
2021-01-29 08:12:50 +03:00
|
|
|
%+ verb |
|
2021-01-12 02:05:39 +03:00
|
|
|
^- agent:gall
|
|
|
|
=<
|
|
|
|
|_ =bowl:gall
|
|
|
|
+* this .
|
|
|
|
def ~(. (default-agent this %|) bowl)
|
|
|
|
gc ~(. +> bowl)
|
|
|
|
io ~(. agentio bowl)
|
|
|
|
++ on-init
|
|
|
|
`this
|
|
|
|
++ on-save
|
|
|
|
!>(state)
|
|
|
|
::
|
|
|
|
++ on-load
|
|
|
|
|= =vase
|
2021-01-29 08:12:50 +03:00
|
|
|
=+ !<(old=state-zero vase)
|
|
|
|
`this(state old)
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
2021-01-29 07:21:13 +03:00
|
|
|
?. ?=(?(%group-view-action %noun) mark)
|
2021-01-12 02:05:39 +03:00
|
|
|
(on-poke:def mark vase)
|
2021-01-29 07:21:13 +03:00
|
|
|
=+ !<(=action:view vase)
|
2021-01-12 02:05:39 +03:00
|
|
|
=^ cards state
|
2021-01-29 07:21:13 +03:00
|
|
|
(jn-start:join:gc +.action)
|
2021-01-12 02:05:39 +03:00
|
|
|
[cards this]
|
|
|
|
::
|
|
|
|
++ on-watch
|
|
|
|
|= =path
|
2021-01-29 07:21:13 +03:00
|
|
|
?+ path (on-watch:def path)
|
|
|
|
[%all ~]
|
|
|
|
:_ this
|
|
|
|
(fact:io group-view-update+!>([%initial ~(key by joining)]) ~)^~
|
|
|
|
==
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
2021-01-29 08:12:50 +03:00
|
|
|
++ on-peek on-peek:def
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ on-agent
|
|
|
|
|= [=wire =sign:agent:gall]
|
|
|
|
=^ cards state
|
|
|
|
?+ wire `state
|
2021-01-29 07:21:13 +03:00
|
|
|
[%join %ship @ @ *]
|
|
|
|
=/ rid
|
|
|
|
(de-path:resource t.wire)
|
|
|
|
?. (~(has by joining) rid) `state
|
|
|
|
(jn-agent:(jn-abed:join:gc rid) t.t.t.t.wire sign)
|
2021-01-12 02:05:39 +03:00
|
|
|
==
|
|
|
|
[cards this]
|
|
|
|
::
|
2021-01-29 08:12:50 +03:00
|
|
|
++ on-arvo on-arvo:def
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
2021-01-29 08:12:50 +03:00
|
|
|
++ on-leave on-leave:def
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
2021-01-29 07:21:13 +03:00
|
|
|
++ on-fail on-fail:def
|
2021-01-12 02:05:39 +03:00
|
|
|
--
|
|
|
|
|_ =bowl:gall
|
|
|
|
++ met ~(. mdl bowl)
|
2021-01-29 07:21:13 +03:00
|
|
|
++ grp ~(. grpl bowl)
|
2021-01-12 02:05:39 +03:00
|
|
|
++ io ~(. agentio bowl)
|
|
|
|
::
|
|
|
|
::
|
|
|
|
++ join
|
2021-01-29 07:21:13 +03:00
|
|
|
|_ [rid=resource =ship]
|
2021-01-12 02:05:39 +03:00
|
|
|
++ jn-core .
|
2021-01-29 07:21:13 +03:00
|
|
|
::
|
|
|
|
++ tx-fact
|
|
|
|
|= =progress:view
|
2021-01-29 07:52:36 +03:00
|
|
|
=; =cage
|
2021-01-29 07:21:13 +03:00
|
|
|
(fact:io cage /all tx+(en-path:resource rid) ~)
|
|
|
|
group-view-update+!>([%progress rid progress])
|
|
|
|
::
|
2021-01-29 05:38:33 +03:00
|
|
|
++ watch-md
|
|
|
|
(watch-our:(jn-pass-io /md) %metadata-store /updates)
|
|
|
|
::
|
|
|
|
++ watch-groups
|
|
|
|
(watch-our:(jn-pass-io /groups) %group-store /groups)
|
|
|
|
::
|
2021-01-12 02:05:39 +03:00
|
|
|
++ jn-pass-io
|
2021-01-29 07:21:13 +03:00
|
|
|
|= pax=path
|
|
|
|
~(. pass:io (welp join+(en-path:resource rid) pax))
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ jn-abed
|
2021-01-29 07:21:13 +03:00
|
|
|
|= r=resource
|
|
|
|
=/ s=^ship
|
|
|
|
(~(got by joining) r)
|
|
|
|
jn-core(rid r, ship s)
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ jn-start
|
|
|
|
|= [rid=resource =^ship]
|
|
|
|
^- (quip card _state)
|
2021-01-29 07:21:13 +03:00
|
|
|
?< (~(has by joining) rid)
|
|
|
|
=. joining
|
|
|
|
(~(put by joining) rid ship)
|
2021-01-12 02:05:39 +03:00
|
|
|
=. jn-core
|
2021-01-29 07:21:13 +03:00
|
|
|
(jn-abed rid)
|
2021-01-12 02:05:39 +03:00
|
|
|
=/ maybe-group
|
2021-01-29 07:52:36 +03:00
|
|
|
(peek-group:met %contacts rid)
|
2021-01-12 02:05:39 +03:00
|
|
|
?^ maybe-group
|
2021-01-29 07:21:13 +03:00
|
|
|
~|("already joined group {<rid>}" !!)
|
|
|
|
:_ state
|
2021-01-29 05:38:33 +03:00
|
|
|
:~ %+ poke:(jn-pass-io /add)
|
|
|
|
[ship %group-push-hook]
|
|
|
|
group-update+!>([%add-members rid (silt our.bowl ~)])
|
|
|
|
::
|
2021-01-29 08:12:50 +03:00
|
|
|
(tx-fact %start)
|
2021-01-29 05:38:33 +03:00
|
|
|
watch-md
|
|
|
|
watch-groups
|
|
|
|
==
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ jn-agent
|
|
|
|
|= [=wire =sign:agent:gall]
|
|
|
|
^- (quip card _state)
|
|
|
|
|^
|
|
|
|
?+ -.wire ~|("bad %join wire" !!)
|
|
|
|
%add :: join group
|
|
|
|
?> ?=(%poke-ack -.sign)
|
|
|
|
?^ p.sign
|
2021-01-29 07:21:13 +03:00
|
|
|
(cleanup %no-perms)
|
|
|
|
:_ state
|
2021-01-29 08:12:50 +03:00
|
|
|
:~ (tx-fact %added)
|
|
|
|
%+ poke-our:(jn-pass-io /pull-groups) %group-pull-hook
|
|
|
|
pull-hook-action+!>([%add ship rid])
|
|
|
|
==
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
%pull-groups
|
|
|
|
?> ?=(%poke-ack -.sign)
|
|
|
|
?~ p.sign
|
|
|
|
:: do nothing, wait for update from store
|
|
|
|
`state
|
|
|
|
:: shouldn't ever fail
|
2021-01-29 05:38:33 +03:00
|
|
|
(cleanup %strange)
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
%groups
|
|
|
|
?+ -.sign !!
|
|
|
|
%fact (groups-fact +.sign)
|
|
|
|
%watch-ack (ack +.sign)
|
|
|
|
%kick groups-kick
|
|
|
|
==
|
|
|
|
::
|
|
|
|
%pull-md
|
|
|
|
?> ?=(%poke-ack -.sign)
|
|
|
|
?~ p.sign `state
|
2021-01-29 05:38:33 +03:00
|
|
|
(cleanup %strange)
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
%md
|
|
|
|
?+ -.sign !!
|
|
|
|
%fact (md-fact +.sign)
|
|
|
|
%watch-ack (ack +.sign)
|
|
|
|
%kick md-kick
|
|
|
|
==
|
|
|
|
::
|
2021-01-29 07:21:13 +03:00
|
|
|
%pull-graphs
|
2021-01-12 02:05:39 +03:00
|
|
|
?> ?=(%poke-ack -.sign)
|
2021-01-29 05:38:33 +03:00
|
|
|
%- cleanup
|
|
|
|
?^(p.sign %strange %done)
|
2021-01-12 02:05:39 +03:00
|
|
|
==
|
|
|
|
++ groups-fact
|
|
|
|
|= =cage
|
|
|
|
?. ?=(%group-update p.cage)
|
|
|
|
`state
|
|
|
|
=+ !<(=update:group-store q.cage)
|
|
|
|
?. ?=(%initial-group -.update)
|
|
|
|
`state
|
|
|
|
?. =(rid resource.update)
|
|
|
|
`state
|
|
|
|
:_ state
|
2021-01-29 05:38:33 +03:00
|
|
|
:_ ~
|
2021-01-29 07:52:36 +03:00
|
|
|
%+ poke-our:(jn-pass-io /pull-md) %metadata-push-hook
|
|
|
|
pull-hook-action+!>([%add [entity .]:rid])
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ md-fact
|
|
|
|
|= [=mark =vase]
|
2021-01-29 07:21:13 +03:00
|
|
|
?. ?=(%metadata-update mark) `state
|
2021-01-29 07:52:36 +03:00
|
|
|
=+ !<(=update:metadata vase)
|
|
|
|
?. ?=(%initial-group -.update) `state
|
|
|
|
?. =(group.update rid) `state
|
2021-01-29 07:21:13 +03:00
|
|
|
=^ cards state
|
|
|
|
(cleanup %done)
|
|
|
|
:_ state
|
|
|
|
%+ welp cards
|
|
|
|
?. hidden:(need (scry-group:grp rid)) ~
|
2021-01-29 07:52:36 +03:00
|
|
|
%+ murn ~(tap by associations.update)
|
|
|
|
|= [=md-resource:metadata =association:metadata]
|
|
|
|
?. =(app-name.md-resource %graph) ~
|
|
|
|
=* rid resource.md-resource
|
|
|
|
:- ~
|
2021-01-29 05:38:33 +03:00
|
|
|
%+ poke-our:(jn-pass-io /pull-graph) %graph-pull-hook
|
2021-01-29 07:21:13 +03:00
|
|
|
pull-hook-action+!>([%add [entity .]:rid])
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ groups-kick
|
|
|
|
:_ state
|
|
|
|
watch-groups^~
|
|
|
|
::
|
|
|
|
++ md-kick
|
|
|
|
:_ state
|
|
|
|
watch-md^~
|
|
|
|
::
|
|
|
|
++ ack
|
|
|
|
|= err=(unit tang)
|
|
|
|
?~ err `state
|
2021-01-29 05:38:33 +03:00
|
|
|
(cleanup %strange)
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
2021-01-29 05:38:33 +03:00
|
|
|
++ cleanup
|
2021-01-29 07:21:13 +03:00
|
|
|
|= =progress:view
|
|
|
|
^- (quip card _state)
|
|
|
|
:_ state(joining (~(del by joining) rid))
|
2021-01-29 05:38:33 +03:00
|
|
|
:~ (leave-our:(jn-pass-io /groups) %group-store)
|
|
|
|
(leave-our:(jn-pass-io /md) %metadata-store)
|
2021-01-29 07:21:13 +03:00
|
|
|
(tx-fact progress)
|
2021-01-29 05:38:33 +03:00
|
|
|
==
|
2021-01-12 02:05:39 +03:00
|
|
|
--
|
|
|
|
--
|
|
|
|
--
|