2021-01-29 07:52:36 +03:00
|
|
|
/- view-sur=group-view, group-store, *group, metadata=metadata-store
|
2021-02-02 22:36:05 +03:00
|
|
|
/+ default-agent, agentio, mdl=metadata,
|
2021-02-03 07:52:48 +03:00
|
|
|
resource, dbug, grpl=group, conl=contact, verb
|
2021-01-12 02:05:39 +03:00
|
|
|
|%
|
|
|
|
++ card card:agent:gall
|
2021-02-16 06:48:23 +03:00
|
|
|
::
|
|
|
|
+$ base-state
|
|
|
|
joining=(map rid=resource [=ship =progress:view])
|
|
|
|
::
|
2021-01-12 02:05:39 +03:00
|
|
|
+$ state-zero
|
2021-02-16 06:48:23 +03:00
|
|
|
[%0 base-state]
|
|
|
|
::
|
|
|
|
+$ state-one
|
|
|
|
[%1 base-state]
|
|
|
|
::
|
|
|
|
+$ versioned-state
|
|
|
|
$% state-zero
|
|
|
|
state-one
|
2021-01-12 02:05:39 +03:00
|
|
|
==
|
2021-02-16 06:48:23 +03:00
|
|
|
::
|
2021-01-29 07:21:13 +03:00
|
|
|
++ view view-sur
|
2021-01-12 02:05:39 +03:00
|
|
|
--
|
2021-02-16 06:48:23 +03:00
|
|
|
=| state-one
|
2021-01-12 02:05:39 +03:00
|
|
|
=* 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-02-16 06:48:23 +03:00
|
|
|
=+ !<(old=versioned-state vase)
|
|
|
|
=| cards=(list card)
|
|
|
|
|-
|
|
|
|
?: ?=(%1 -.old)
|
|
|
|
`this(state old)
|
|
|
|
$(-.old %1, cards :_(cards (poke-self:pass:io noun+!>(%cleanup))))
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
2021-02-16 06:48:23 +03:00
|
|
|
?: ?=(%noun mark)
|
|
|
|
=^ cards state
|
|
|
|
poke-noun:gc
|
|
|
|
[cards this]
|
|
|
|
?. ?=(%group-view-action 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-02-01 09:27:38 +03:00
|
|
|
?> ?=(%join -.action)
|
2021-01-12 02:05:39 +03:00
|
|
|
=^ cards state
|
2021-02-01 04:57:56 +03:00
|
|
|
jn-abet:(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
|
2021-02-01 04:57:56 +03:00
|
|
|
:_ ~
|
|
|
|
%+ fact:io
|
|
|
|
:- %group-view-update
|
|
|
|
!> ^- update:view
|
|
|
|
[%initial (~(run by joining) |=([=ship =progress:view] progress))]
|
|
|
|
~
|
2021-01-29 07:21:13 +03:00
|
|
|
==
|
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
|
2021-02-01 04:57:56 +03:00
|
|
|
jn-abet:(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
|
|
|
|
++ on-leave on-leave:def
|
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)
|
2021-02-03 07:52:48 +03:00
|
|
|
++ con ~(. conl bowl)
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
2021-02-16 06:48:23 +03:00
|
|
|
++ has-joined
|
|
|
|
|= rid=resource
|
|
|
|
=- ?=(^ -)
|
|
|
|
?~ grp=(peek-group:met %groups rid)
|
|
|
|
(peek-group:met %graph rid)
|
|
|
|
grp
|
|
|
|
::
|
|
|
|
++ poke-noun
|
|
|
|
^- (quip card _state)
|
|
|
|
=; new-joining=(map resource [ship progress:view])
|
|
|
|
`state(joining new-joining)
|
|
|
|
%+ roll ~(tap by joining)
|
|
|
|
|= [[rid=resource =ship =progress:view] out=_joining]
|
|
|
|
?. (has-joined rid) out
|
|
|
|
(~(del by out) rid)
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ join
|
2021-02-01 04:57:56 +03:00
|
|
|
|_ [rid=resource =ship cards=(list card)]
|
2021-01-12 02:05:39 +03:00
|
|
|
++ jn-core .
|
2021-02-01 04:57:56 +03:00
|
|
|
++ emit-many
|
|
|
|
|= crds=(list card)
|
|
|
|
jn-core(cards (weld (flop crds) cards))
|
2021-02-02 01:36:16 +03:00
|
|
|
::
|
2021-02-01 04:57:56 +03:00
|
|
|
++ emit
|
|
|
|
|= =card
|
|
|
|
jn-core(cards [card cards])
|
2021-01-29 07:21:13 +03:00
|
|
|
::
|
2021-02-01 04:57:56 +03:00
|
|
|
++ tx-progress
|
2021-01-29 07:21:13 +03:00
|
|
|
|= =progress:view
|
2021-02-01 04:57:56 +03:00
|
|
|
=. joining
|
|
|
|
(~(put by joining) rid [ship progress])
|
2021-01-29 07:52:36 +03:00
|
|
|
=; =cage
|
2021-02-01 04:57:56 +03:00
|
|
|
(emit (fact:io cage /all tx+(en-path:resource rid) ~))
|
2021-01-29 07:21:13 +03:00
|
|
|
group-view-update+!>([%progress rid progress])
|
|
|
|
::
|
2021-01-29 05:38:33 +03:00
|
|
|
++ watch-md
|
2021-02-01 04:57:56 +03:00
|
|
|
(emit (watch-our:(jn-pass-io /md) %metadata-store /updates))
|
2021-01-29 05:38:33 +03:00
|
|
|
::
|
|
|
|
++ watch-groups
|
2021-02-01 04:57:56 +03:00
|
|
|
(emit (watch-our:(jn-pass-io /groups) %group-store /groups))
|
2021-01-29 05:38:33 +03:00
|
|
|
::
|
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
|
2021-02-01 04:57:56 +03:00
|
|
|
=/ [s=^ship =progress:view]
|
2021-01-29 07:21:13 +03:00
|
|
|
(~(got by joining) r)
|
|
|
|
jn-core(rid r, ship s)
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
2021-02-01 04:57:56 +03:00
|
|
|
++ jn-abet
|
|
|
|
^- (quip card _state)
|
|
|
|
[(flop cards) state]
|
|
|
|
::
|
2021-01-12 02:05:39 +03:00
|
|
|
++ jn-start
|
|
|
|
|= [rid=resource =^ship]
|
2021-02-01 04:57:56 +03:00
|
|
|
^+ jn-core
|
2021-01-29 07:21:13 +03:00
|
|
|
?< (~(has by joining) rid)
|
|
|
|
=. joining
|
2021-02-01 04:57:56 +03:00
|
|
|
(~(put by joining) rid [ship %start])
|
2021-01-12 02:05:39 +03:00
|
|
|
=. jn-core
|
2021-01-29 07:21:13 +03:00
|
|
|
(jn-abed rid)
|
2021-02-16 06:48:23 +03:00
|
|
|
?< ~|("already joined {<rid>}" (has-joined rid))
|
2021-02-01 04:57:56 +03:00
|
|
|
=. jn-core
|
|
|
|
%- emit
|
|
|
|
%+ poke:(jn-pass-io /add)
|
|
|
|
[ship %group-push-hook]
|
|
|
|
group-update+!>([%add-members rid (silt our.bowl ~)])
|
|
|
|
=. jn-core (tx-progress %start)
|
|
|
|
=> watch-md
|
|
|
|
watch-groups
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ jn-agent
|
|
|
|
|= [=wire =sign:agent:gall]
|
2021-02-01 04:57:56 +03:00
|
|
|
^+ jn-core
|
2021-01-12 02:05:39 +03:00
|
|
|
|^
|
|
|
|
?+ -.wire ~|("bad %join wire" !!)
|
|
|
|
%add :: join group
|
|
|
|
?> ?=(%poke-ack -.sign)
|
|
|
|
?^ p.sign
|
2021-01-29 07:21:13 +03:00
|
|
|
(cleanup %no-perms)
|
2021-02-01 04:57:56 +03:00
|
|
|
=> %- emit
|
2021-01-29 08:12:50 +03:00
|
|
|
%+ poke-our:(jn-pass-io /pull-groups) %group-pull-hook
|
|
|
|
pull-hook-action+!>([%add ship rid])
|
2021-02-01 04:57:56 +03:00
|
|
|
(tx-progress %added)
|
2021-02-02 01:36:16 +03:00
|
|
|
::
|
2021-01-12 02:05:39 +03:00
|
|
|
%pull-groups
|
|
|
|
?> ?=(%poke-ack -.sign)
|
2021-02-01 04:57:56 +03:00
|
|
|
(ack +.sign)
|
2021-02-02 01:36:16 +03:00
|
|
|
::
|
2021-01-12 02:05:39 +03:00
|
|
|
%groups
|
|
|
|
?+ -.sign !!
|
|
|
|
%fact (groups-fact +.sign)
|
|
|
|
%watch-ack (ack +.sign)
|
2021-02-01 04:57:56 +03:00
|
|
|
%kick watch-groups
|
2021-01-12 02:05:39 +03:00
|
|
|
==
|
2021-02-02 01:36:16 +03:00
|
|
|
::
|
2021-01-12 02:05:39 +03:00
|
|
|
%pull-md
|
|
|
|
?> ?=(%poke-ack -.sign)
|
2021-02-01 04:57:56 +03:00
|
|
|
(ack +.sign)
|
2021-02-02 01:36:16 +03:00
|
|
|
::
|
|
|
|
%pull-co
|
|
|
|
?> ?=(%poke-ack -.sign)
|
|
|
|
(ack +.sign)
|
2021-02-02 22:36:05 +03:00
|
|
|
::
|
|
|
|
%share-co
|
|
|
|
?> ?=(%poke-ack -.sign)
|
|
|
|
(ack +.sign)
|
2021-02-03 04:13:33 +03:00
|
|
|
::
|
|
|
|
%push-co
|
|
|
|
?> ?=(%poke-ack -.sign)
|
|
|
|
(ack +.sign)
|
2021-02-02 01:36:16 +03:00
|
|
|
::
|
2021-01-12 02:05:39 +03:00
|
|
|
%md
|
|
|
|
?+ -.sign !!
|
|
|
|
%fact (md-fact +.sign)
|
|
|
|
%watch-ack (ack +.sign)
|
2021-02-01 04:57:56 +03:00
|
|
|
%kick watch-md
|
2021-01-12 02:05:39 +03:00
|
|
|
==
|
2021-02-02 01:36:16 +03:00
|
|
|
::
|
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
|
|
|
==
|
2021-02-02 01:36:16 +03:00
|
|
|
::
|
2021-01-12 02:05:39 +03:00
|
|
|
++ groups-fact
|
|
|
|
|= =cage
|
2021-03-11 07:05:50 +03:00
|
|
|
?. ?=(%group-update-0 p.cage) jn-core
|
2021-01-12 02:05:39 +03:00
|
|
|
=+ !<(=update:group-store q.cage)
|
2021-02-01 04:57:56 +03:00
|
|
|
?. ?=(%initial-group -.update) jn-core
|
|
|
|
?. =(rid resource.update) jn-core
|
2021-02-02 01:36:16 +03:00
|
|
|
%- emit-many
|
|
|
|
=/ cag=^cage pull-hook-action+!>([%add [entity .]:rid])
|
2021-02-02 22:36:05 +03:00
|
|
|
%- zing
|
|
|
|
:~ [(poke-our:(jn-pass-io /pull-md) %metadata-pull-hook cag)]~
|
|
|
|
[(poke-our:(jn-pass-io /pull-co) %contact-pull-hook cag)]~
|
2021-02-03 04:13:33 +03:00
|
|
|
::
|
2021-02-02 22:36:05 +03:00
|
|
|
?. scry-is-public:con ~
|
|
|
|
:_ ~
|
|
|
|
%+ poke:(jn-pass-io /share-co)
|
|
|
|
[entity.rid %contact-push-hook]
|
|
|
|
[%contact-share !>([%share our.bowl])]
|
2021-02-02 01:36:16 +03:00
|
|
|
==
|
2021-01-12 02:05:39 +03:00
|
|
|
::
|
|
|
|
++ md-fact
|
|
|
|
|= [=mark =vase]
|
2021-03-11 07:05:50 +03:00
|
|
|
?. ?=(%metadata-update-0 mark) jn-core
|
2021-01-29 07:52:36 +03:00
|
|
|
=+ !<(=update:metadata vase)
|
2021-02-01 04:57:56 +03:00
|
|
|
?. ?=(%initial-group -.update) jn-core
|
|
|
|
?. =(group.update rid) jn-core
|
|
|
|
=. jn-core (cleanup %done)
|
|
|
|
?. hidden:(need (scry-group:grp rid)) jn-core
|
|
|
|
%- emit-many
|
2021-01-29 07:52:36 +03:00
|
|
|
%+ murn ~(tap by associations.update)
|
|
|
|
|= [=md-resource:metadata =association:metadata]
|
2021-02-01 04:57:56 +03:00
|
|
|
^- (unit card)
|
2021-01-29 07:52:36 +03:00
|
|
|
?. =(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
|
|
|
::
|
|
|
|
++ ack
|
|
|
|
|= err=(unit tang)
|
2021-02-01 04:57:56 +03:00
|
|
|
?~ err jn-core
|
|
|
|
%- (slog u.err)
|
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
|
2021-02-01 04:57:56 +03:00
|
|
|
=. jn-core
|
|
|
|
(tx-progress progress)
|
|
|
|
=. joining (~(del by joining) rid)
|
|
|
|
=. jn-core
|
|
|
|
(emit (leave-our:(jn-pass-io /groups) %group-store))
|
|
|
|
(emit (leave-our:(jn-pass-io /md) %metadata-store))
|
2021-01-12 02:05:39 +03:00
|
|
|
--
|
|
|
|
--
|
|
|
|
--
|