2022-11-22 09:09:40 +03:00
|
|
|
:: Migrate scripts
|
|
|
|
/- gra=graph-store
|
|
|
|
/- met=metadata-store
|
|
|
|
/- grp=group-store
|
|
|
|
/- i=migrate
|
|
|
|
/- *group
|
|
|
|
|_ =bowl:gall
|
|
|
|
+$ card card:agent:gall
|
2022-11-29 06:25:15 +03:00
|
|
|
:: if false, indicates that OTA should be done in one go, in order to
|
|
|
|
:: allow for testing on partial testnets
|
|
|
|
++ split-ota &
|
2022-11-23 07:29:40 +03:00
|
|
|
++ import-club
|
|
|
|
|= [=^groups =associations:met =network:gra]
|
|
|
|
%- ~(gas by *imports:club:i)
|
|
|
|
%+ murn ~(tap by graphs.network)
|
|
|
|
|= [=flag:i graph=graph:gra mar=(unit mark)]
|
|
|
|
^- (unit [flag:i import:club:i])
|
|
|
|
?. =(mar `%graph-validator-chat)
|
|
|
|
~
|
|
|
|
?~ assoc=(~(get by associations) [%graph flag])
|
|
|
|
~& missing-assoc-club/flag
|
|
|
|
~
|
|
|
|
?~ group=(~(get by groups) group.u.assoc)
|
|
|
|
~& missing-group/[flag group.u.assoc]
|
|
|
|
~
|
|
|
|
?. hidden.u.group
|
|
|
|
~
|
|
|
|
`[flag members.u.group u.assoc graph]
|
|
|
|
::
|
2022-11-24 08:42:50 +03:00
|
|
|
++ import-flags
|
|
|
|
|= [=^groups =associations:met =network:gra]
|
|
|
|
|= =mark
|
|
|
|
^- (set flag:i)
|
|
|
|
~(key by ((import-for-mark ~ groups associations network) mark))
|
|
|
|
::
|
2022-11-22 09:09:40 +03:00
|
|
|
++ import-for-mark
|
2022-11-24 08:42:50 +03:00
|
|
|
|= [her=(unit ship) =^groups =associations:met =network:gra]
|
2022-11-22 09:09:40 +03:00
|
|
|
|= =mark
|
|
|
|
^- imports:graph:i
|
|
|
|
%- ~(gas by *imports:graph:i)
|
|
|
|
%+ murn ~(tap by graphs.network)
|
|
|
|
|= [=flag:i graph=graph:gra mar=(unit ^mark)]
|
2022-11-24 08:42:50 +03:00
|
|
|
?. |(=(`p.flag her) =(her ~))
|
2022-11-22 09:09:40 +03:00
|
|
|
~
|
|
|
|
?. =(mar `mark) :: XX: correct detection?
|
|
|
|
~
|
|
|
|
?~ assoc=(~(get by associations) [%graph flag])
|
|
|
|
~& missing-assoc/flag^mark
|
|
|
|
~
|
|
|
|
?~ group=(~(get by groups) group.u.assoc)
|
|
|
|
~& missing-group/[flag group.u.assoc]
|
|
|
|
~
|
2022-11-23 07:29:40 +03:00
|
|
|
?: hidden.u.group
|
|
|
|
~
|
2022-11-22 09:09:40 +03:00
|
|
|
=/ writers=(set ship)
|
|
|
|
(~(get ju tags.u.group) %graph flag %writers)
|
|
|
|
?~ log=(~(get by update-logs.network) flag)
|
|
|
|
~& missing-log/flag :: XX: doesn't need to fail, but suspect case
|
|
|
|
~
|
|
|
|
`[flag writers u.assoc u.log graph]
|
|
|
|
|
|
|
|
++ scry
|
|
|
|
|= [=dude:gall =path]
|
|
|
|
%- welp
|
|
|
|
:_ path
|
|
|
|
/gx/(scot %p our.bowl)/[dude]/(scot %da now.bowl)
|
|
|
|
++ groups
|
|
|
|
~+ .^([@ =^groups *] (scry %group-store /export/noun))
|
2022-11-24 07:21:17 +03:00
|
|
|
++ groups-raw
|
|
|
|
.^(* (scry %group-store /export/noun))
|
2022-11-22 09:09:40 +03:00
|
|
|
++ network
|
|
|
|
~+ .^([@ =network:gra] (scry %graph-store /export/noun))
|
2022-11-24 07:21:17 +03:00
|
|
|
++ network-raw
|
|
|
|
.^(* (scry %graph-store /export/noun))
|
2022-11-22 09:09:40 +03:00
|
|
|
++ associations
|
2022-11-24 07:21:17 +03:00
|
|
|
~+ .^([@ =associations:met ~] (scry %metadata-store /export/noun))
|
|
|
|
++ associations-raw
|
|
|
|
.^(* (scry %metadata-store /export/noun))
|
|
|
|
++ export
|
|
|
|
%- jam
|
|
|
|
^- *
|
|
|
|
:~ [%group-store groups-raw]
|
|
|
|
[%metadata-store associations-raw]
|
|
|
|
==
|
2022-11-22 09:09:40 +03:00
|
|
|
++ peers
|
|
|
|
|= =network:gra
|
|
|
|
=- (~(del in -) our.bowl)
|
|
|
|
%- ~(gas in *(set ship))
|
|
|
|
(turn ~(tap in ~(key by graphs.network)) head)
|
|
|
|
++ poke-our
|
|
|
|
|= [=dude:gall =cage]
|
2022-11-23 05:43:11 +03:00
|
|
|
[%pass /gladio %agent [our.bowl dude] %poke cage]
|
2022-11-22 09:09:40 +03:00
|
|
|
++ migrate-start
|
|
|
|
^- (quip card (set ship))
|
|
|
|
=+ network
|
|
|
|
=+ associations
|
2022-11-24 07:21:17 +03:00
|
|
|
=+ groups
|
2022-11-22 09:09:40 +03:00
|
|
|
=/ ships (peers network)
|
|
|
|
=/ dms (~(get by graphs:network) [our.bowl %dm-inbox])
|
2022-11-24 08:42:50 +03:00
|
|
|
=/ import (import-for-mark `our.bowl groups associations network)
|
2022-11-23 07:29:40 +03:00
|
|
|
=/ clubs (import-club groups associations network)
|
2022-11-22 09:09:40 +03:00
|
|
|
=/ chats=imports:graph:i
|
|
|
|
(import %graph-validator-chat)
|
|
|
|
=/ diarys=imports:graph:i
|
|
|
|
(import %graph-validator-publish)
|
|
|
|
=/ links=imports:graph:i
|
|
|
|
(import %graph-validator-link)
|
|
|
|
=/ =imports:groups:i
|
|
|
|
%- ~(gas by *imports:groups:i)
|
|
|
|
%+ murn ~(tap by groups)
|
|
|
|
|= [=flag:i =group]
|
|
|
|
^- (unit [_flag import:groups:i])
|
2022-11-23 07:29:40 +03:00
|
|
|
?: hidden.group
|
|
|
|
~
|
2022-11-22 09:09:40 +03:00
|
|
|
?~ assoc=(~(get by associations) [%groups flag])
|
|
|
|
~& missing-group-assoc/flag
|
|
|
|
~
|
|
|
|
=/ chans=(map flag:i association:met)
|
|
|
|
%- ~(gas by *(map flag:i association:met))
|
|
|
|
%+ murn ~(tap by associations)
|
|
|
|
|= [res=md-resource:met ass=association:met]
|
|
|
|
^- (unit [flag:i association:met])
|
|
|
|
?. =(group.ass flag) ~
|
|
|
|
`[resource.res ass]
|
|
|
|
=/ roles=(set flag:i)
|
|
|
|
%- ~(gas in *(set flag:i))
|
|
|
|
%+ murn ~(tap by chans)
|
|
|
|
|= [=flag:i =association:met]
|
|
|
|
^- (unit flag:i)
|
|
|
|
?^ link=(~(get by links) flag)
|
|
|
|
?: =(writers.u.link ~) ~
|
|
|
|
`flag
|
|
|
|
?^ diary=(~(get by diarys) flag)
|
|
|
|
?: =(writers.u.diary ~) ~
|
|
|
|
`flag
|
|
|
|
?^ chat=(~(get by chats) flag)
|
|
|
|
?: =(writers.u.chat ~) ~
|
|
|
|
`flag
|
|
|
|
~
|
|
|
|
`[flag u.assoc chans roles group]
|
|
|
|
=/ dms (~(get by graphs:network) [our.bowl %dm-inbox])
|
2022-11-24 08:42:50 +03:00
|
|
|
=/ flag-importer (import-flags groups associations network)
|
|
|
|
=+ :* chat-flags=(flag-importer %graph-validator-chat)
|
|
|
|
heap-flags=(flag-importer %graph-validator-link)
|
|
|
|
diary-flags=(flag-importer %graph-validator-publish)
|
|
|
|
==
|
2022-11-29 06:25:15 +03:00
|
|
|
=/ setup=(list card)
|
|
|
|
%+ welp (migrate-ship our.bowl)
|
|
|
|
:* (poke-our %groups group-import+!>(imports))
|
|
|
|
(poke-our %chat import-flags+!>(chat-flags))
|
|
|
|
(poke-our %heap import-flags+!>(heap-flags))
|
|
|
|
(poke-our %diary import-flags+!>(diary-flags))
|
|
|
|
(poke-our %chat club-imports+!>(clubs))
|
|
|
|
?~ dms ~
|
|
|
|
(poke-our %chat dm-imports+!>(p.u.dms))^~
|
|
|
|
==
|
|
|
|
?. split-ota
|
|
|
|
:_ ~
|
|
|
|
(welp setup (zing (turn ~(tap in (~(del in ships) our.bowl)) migrate-ship)))
|
|
|
|
[setup ships]
|
2022-11-22 09:09:40 +03:00
|
|
|
::
|
|
|
|
++ migrate-ship
|
|
|
|
|= her=ship
|
|
|
|
^- (list card)
|
|
|
|
=+ groups
|
|
|
|
=+ network
|
|
|
|
=+ associations
|
2022-11-24 08:42:50 +03:00
|
|
|
=/ import (import-for-mark `her groups associations network)
|
2022-11-22 09:09:40 +03:00
|
|
|
=/ chats=imports:graph:i
|
|
|
|
(import %graph-validator-chat)
|
|
|
|
=/ diarys=imports:graph:i
|
|
|
|
(import %graph-validator-publish)
|
|
|
|
=/ links=imports:graph:i
|
|
|
|
(import %graph-validator-link)
|
2022-11-24 07:21:17 +03:00
|
|
|
=/ graph-flags
|
|
|
|
%. ~(key by links)
|
|
|
|
=- ~(uni in -)
|
|
|
|
(~(uni in ~(key by chats)) ~(key by diarys))
|
|
|
|
%+ welp
|
|
|
|
%+ turn ~(tap in graph-flags)
|
|
|
|
|= =flag:i
|
|
|
|
^- card
|
|
|
|
(poke-our %graph-store migrated+!>(flag))
|
2022-11-22 09:09:40 +03:00
|
|
|
:~ (poke-our %chat graph-imports+!>(chats))
|
|
|
|
(poke-our %diary graph-imports+!>(diarys))
|
|
|
|
(poke-our %heap graph-imports+!>(links))
|
2022-11-24 07:21:17 +03:00
|
|
|
==
|
2022-11-22 09:09:40 +03:00
|
|
|
--
|