mirror of
https://github.com/urbit/shrub.git
synced 2024-12-22 02:11:38 +03:00
metadata-store,hook: add OTA adapter
This commit is contained in:
parent
3fa761aaf3
commit
55c2991a9b
@ -6,13 +6,14 @@
|
|||||||
:: /group/%group-path all updates related to this group
|
:: /group/%group-path all updates related to this group
|
||||||
::
|
::
|
||||||
/- *metadata-store, *metadata-hook
|
/- *metadata-store, *metadata-hook
|
||||||
/+ default-agent, dbug, verb, grpl=group, *migrate
|
/+ default-agent, dbug, verb, grpl=group, *migrate, resource
|
||||||
~% %metadata-hook-top ..part ~
|
~% %metadata-hook-top ..part ~
|
||||||
|%
|
|%
|
||||||
+$ card card:agent:gall
|
+$ card card:agent:gall
|
||||||
+$ versioned-state
|
+$ versioned-state
|
||||||
$% state-zero
|
$% state-zero
|
||||||
state-one
|
state-one
|
||||||
|
state-two
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
+$ state-zero
|
+$ state-zero
|
||||||
@ -23,10 +24,60 @@
|
|||||||
$: %1
|
$: %1
|
||||||
synced=(map group-path ship)
|
synced=(map group-path ship)
|
||||||
==
|
==
|
||||||
|
+$ state-two
|
||||||
|
[%2 ~]
|
||||||
--
|
--
|
||||||
=| state-one
|
=| state-one
|
||||||
=* state -
|
=* state -
|
||||||
%- agent:dbug
|
%- agent:dbug
|
||||||
%+ verb |
|
%+ verb |
|
||||||
^- agent:gall
|
^- agent:gall
|
||||||
(default-agent *agent:gall %|)
|
|_ =bowl:gall
|
||||||
|
+* this .
|
||||||
|
def ~(. (default-agent *agent:gall %|) bowl)
|
||||||
|
++ on-init on-init:def
|
||||||
|
++ on-save !>(state)
|
||||||
|
++ on-load
|
||||||
|
|= =vase
|
||||||
|
=+ !<(old=versioned-state vase)
|
||||||
|
|^
|
||||||
|
?: ?=(%2 -.old)
|
||||||
|
`this
|
||||||
|
:_ this
|
||||||
|
%+ murn
|
||||||
|
~(tap by synced.old)
|
||||||
|
|= [group=path =ship]
|
||||||
|
%+ bind
|
||||||
|
(de-path-soft:resource group)
|
||||||
|
|= rid=resource
|
||||||
|
?: =(our.bowl ship)
|
||||||
|
(push-metadata rid)
|
||||||
|
(pull-metadata rid ship)
|
||||||
|
::
|
||||||
|
++ poke-our
|
||||||
|
|= [app=term =cage]
|
||||||
|
^- card
|
||||||
|
[%pass / %agent [our.bowl app] %poke cage]
|
||||||
|
::
|
||||||
|
++ push-metadata
|
||||||
|
|= rid=resource
|
||||||
|
^- card
|
||||||
|
(poke-our %metadata-push-hook push-hook-action+!>([%add rid]))
|
||||||
|
::
|
||||||
|
++ pull-metadata
|
||||||
|
|= [rid=resource =ship]
|
||||||
|
^- card
|
||||||
|
(poke-our %metadata-pull-hook pull-hook-action+!>([%add ship rid]))
|
||||||
|
--
|
||||||
|
|
||||||
|
++ on-poke on-poke:def
|
||||||
|
++ on-watch on-watch:def
|
||||||
|
++ on-peek on-peek:def
|
||||||
|
++ on-leave on-leave:def
|
||||||
|
++ on-agent on-agent:def
|
||||||
|
++ on-arvo on-arvo:def
|
||||||
|
++ on-fail on-fail:def
|
||||||
|
--
|
||||||
|
::
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,9 +44,18 @@
|
|||||||
creator=@p
|
creator=@p
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
+$ metadata-1
|
||||||
|
$: title=@t
|
||||||
|
description=@t
|
||||||
|
color=@ux
|
||||||
|
date-created=@da
|
||||||
|
creator=@p
|
||||||
|
module=term
|
||||||
|
==
|
||||||
|
::
|
||||||
+$ md-resource-1 [=app-name =app-path]
|
+$ md-resource-1 [=app-name =app-path]
|
||||||
::
|
::
|
||||||
+$ associations-1 (map [group-path md-resource-1] metadata)
|
+$ associations-1 (map [group-path md-resource-1] metadata-1)
|
||||||
::
|
::
|
||||||
+$ base-state-1
|
+$ base-state-1
|
||||||
$: associations=associations-1
|
$: associations=associations-1
|
||||||
@ -198,6 +207,7 @@
|
|||||||
=/ old !<(versioned-state vase)
|
=/ old !<(versioned-state vase)
|
||||||
=| cards=(list card)
|
=| cards=(list card)
|
||||||
|^
|
|^
|
||||||
|
=* loop $
|
||||||
?: ?=(%7 -.old)
|
?: ?=(%7 -.old)
|
||||||
:- cards
|
:- cards
|
||||||
%_ state
|
%_ state
|
||||||
@ -226,10 +236,37 @@
|
|||||||
associations.old associations
|
associations.old associations
|
||||||
==
|
==
|
||||||
:: pre-breach, can safely throw away
|
:: pre-breach, can safely throw away
|
||||||
$(old *state-7)
|
loop(old *state-7)
|
||||||
|
::
|
||||||
++ associations-1-to-2
|
++ associations-1-to-2
|
||||||
|= assoc=*
|
|= assoc=associations-1
|
||||||
*^associations
|
^- ^associations
|
||||||
|
%- ~(gas by *^associations)
|
||||||
|
%+ murn
|
||||||
|
~(tap by assoc)
|
||||||
|
|= [[group=path m=md-resource-1] met=metadata-1]
|
||||||
|
%+ biff (de-path-soft:resource group)
|
||||||
|
|= g=resource
|
||||||
|
%+ bind (md-resource-1-to-2 m)
|
||||||
|
|= =md-resource
|
||||||
|
[md-resource g (metadata-1-to-2 met)]
|
||||||
|
::
|
||||||
|
++ md-resource-1-to-2
|
||||||
|
|= m=md-resource-1
|
||||||
|
^- (unit md-resource)
|
||||||
|
%+ bind (de-path-soft:resource app-path.m)
|
||||||
|
|=(rid=resource [app-name.m rid])
|
||||||
|
::
|
||||||
|
++ metadata-1-to-2
|
||||||
|
|= m=metadata-1
|
||||||
|
%* . *metadata
|
||||||
|
title title.m
|
||||||
|
description description.m
|
||||||
|
color color.m
|
||||||
|
date-created date-created.m
|
||||||
|
creator creator.m
|
||||||
|
module module.m
|
||||||
|
==
|
||||||
::
|
::
|
||||||
++ rebuild-resource-indices
|
++ rebuild-resource-indices
|
||||||
|= =^associations
|
|= =^associations
|
||||||
@ -258,8 +295,8 @@
|
|||||||
^- associations-1
|
^- associations-1
|
||||||
%- malt
|
%- malt
|
||||||
%+ turn ~(tap by associations)
|
%+ turn ~(tap by associations)
|
||||||
|= [[=group-path md-resource=md-resource-1] m=metadata]
|
|= [[=group-path md-resource=md-resource-1] m=metadata-1]
|
||||||
^- [[^group-path md-resource-1] metadata]
|
^- [[^group-path md-resource-1] metadata-1]
|
||||||
?. =(app-name.md-resource app)
|
?. =(app-name.md-resource app)
|
||||||
[[group-path md-resource] m]
|
[[group-path md-resource] m]
|
||||||
=/ new-app-path=path
|
=/ new-app-path=path
|
||||||
|
Loading…
Reference in New Issue
Block a user