:: metadata: helpers for getting data from the metadata-store :: /- store=metadata-store /+ resource :: |_ =bowl:gall ++ resource-for-update |= =vase ^- (list resource) =/ =update:store !<(update:store vase) ?. ?=(?(%add %remove %initial-group) -.update) ~ ~[group.update] :: ++ app-paths-from-group |= [=app-name:store group=resource] ^- (list resource) %+ murn %~ tap in =- (~(gut by -) group ~) .^ (jug resource md-resource:store) %gy (scot %p our.bowl) %metadata-store (scot %da now.bowl) /group-indices == |= =md-resource:store ^- (unit resource) ?. =(app-name.md-resource app-name) ~ `resource.md-resource :: ++ app-metadata-for-group |= [group=resource =app-name:store] =/ =associations:store (metadata-for-group group) %- ~(gas by *associations:store) %+ skim ~(tap by associations) |= [=md-resource:store association:store] =(app-name app-name.md-resource) :: ++ metadata-for-group |= group=resource .^ associations:store %gx (scot %p our.bowl) %metadata-store (scot %da now.bowl) %group (snoc (en-path:resource group) %noun) == :: ++ md-resources-from-group |= group=resource =- (~(get ju -) group) .^ (jug resource md-resource:store) %gy (scot %p our.bowl) %metadata-store (scot %da now.bowl) /group-indices == :: ++ peek-association |= [app-name=term rid=resource] .^ (unit association:store) %gx (scot %p our.bowl) %metadata-store (scot %da now.bowl) %metadata app-name (snoc (en-path:resource rid) %noun) == :: ++ peek-metadatum |= =md-resource:store %+ bind (peek-association md-resource) |=(association:store metadatum) :: ++ peek-group |= =md-resource:store ^- (unit resource) %+ bind (peek-association md-resource) |=(association:store group) --