metadata-store: remove dangling entries upon %initial-group
|= [group=resource =associations:store]
=/ assocs=(list [=md-resource:store grp=resource =metadatum:store])
~(tap by associations)
- :- (send-diff:mc %initial-group group associations)
+ =/ old-resources=(set md-resource:store) (~(get ju group-indices) group)
+ =/ cur-resources=(set md-resource:store) ~(key by assocs)
+ =. state (remove-gone group (~(dif in old-resource) cur-resource))
|-
?~ assocs
- state
+ :_ state
+ (send-diff:mc %initial-group group associations)
=, assocs
?> =(group grp.i)
=^ cards state
(handle-add group [md-resource metadatum]:i)
$(assocs t)
+ ::
+ ++ remove-gone
+ |= [group=resource gone=(set md-resource:store)
+ ^+ state
+ %+ roll ~(tap in gone)
+ |= [=md-resource:store out=_state]
+ %_ out
+ associations (~(del by associations.out) md-resource)
+ group-indices (~(del ju group-indices.out) group md-resource)
+ resource-indices (~(del ju resource-indices.out) md-resource group)
+ ::
+ app-indices
+ (~(del ju app-indices.out) app.md-resource group resource.md-resource)
+ ==
--
::
++ poke-import
