mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-13 08:38:43 +03:00
chat-hook: fall back if metadata-store not live
This temporary, upgrade-oriented logic depends on two assumptions: - If the metadata-store is not running, we are still in the process of applying the upgrade. - If the above is true, all chats are /~host/name, all groups are /~/~host/name, and they have a strict one-to-one relation. Armed with those assumptions, we can deduce groups from chats and vice versa without depending on the metadata-store, allowing us to carry on as if it were already running.
This commit is contained in:
parent
337dc03f6b
commit
c3becc9f5f
@ -598,6 +598,17 @@
|
||||
++ chats-of-group
|
||||
|= =group-path
|
||||
^- (list path)
|
||||
:: if metadata-store isn't running yet, we're still in the upgrade ota phase.
|
||||
:: we can't get chats from the metadata-store, but can make assumptions
|
||||
:: about group path shape, and the chat that would match it.
|
||||
::TODO remove me at some point.
|
||||
::
|
||||
?. .^(? %gu (scot %p our.bol) %metadata-store (scot %da now.bol) ~)
|
||||
?: ?=([%'~' @ ^] group-path)
|
||||
~& [%assuming-ported-legacy-group group-path]
|
||||
[t.group-path]~
|
||||
~& [%weird-group group-path]
|
||||
~
|
||||
%+ murn
|
||||
^- (list resource)
|
||||
=- ~(tap in (~(gut by -) group-path ~))
|
||||
@ -616,6 +627,17 @@
|
||||
++ groups-of-chat
|
||||
|= chat=path
|
||||
^- (list group-path)
|
||||
:: if metadata-store isn't running yet, we're still in the upgrade ota phase.
|
||||
:: we can't get groups from the metadata-store, but can make assumptions
|
||||
:: about chat path shape, and the chat that would match it.
|
||||
::TODO remove me at some point.
|
||||
::
|
||||
?. .^(? %gu (scot %p our.bol) %metadata-store (scot %da now.bol) ~)
|
||||
?: ?=([@ ^] chat)
|
||||
~& [%assuming-ported-legacy-chat chat]
|
||||
[%'~' chat]~
|
||||
~& [%weird-chat chat]
|
||||
~
|
||||
=- ~(tap in (~(gut by -) [%chat chat] ~))
|
||||
.^ (jug resource group-path)
|
||||
%gy
|
||||
|
Loading…
Reference in New Issue
Block a user