1 import Base 2 import ./execution_resource_policy.bend as Policy 3 import ./execution_composer_layout.bend as L 4 import ./execution_query_schema.bend as Routes 5 import ./owner_product.bend as Product 6 import ./lifecycle.bend as Life 7 8 type Info is Data: 9 Info{route:L.Route,key:String,stamp:Life.Stamp} 10 type Description<-S:Data,-full:L.Layout> is Type: 11 Description{resources:L.resources(~S,full),info:List<&2,Info>} 12 def described_pair(~S:Data,-ll:L.Layout,-rr:L.Layout,left:Description,right:Description) -> Description: 13 match left right: 14 case Description{left,li} Description{right,ri}:Description{Product.Owner{left,right},List.append(&2,Info,li,ri)} 15 # Describes genuine stored stamps without projecting, refreshing or stamping P. 16 def describe(~S:Data,layout:L.Layout,+route:L.Route,resources:L.resources(~S,layout)) -> Description: 17 match layout resources: 18 case L.EmptyLayout{} Unit{}:Description{Unit{},[]} 19 case L.LayoutLeaf{P,V,refresh,+key,_} L.ResourceSlot{owner,+stamp}:Description{L.ResourceSlot{owner,stamp},[Info{route,key,stamp}]} 20 case L.ClassifiedLayoutLeaf{P,V,refresh,+key,kind,_} L.ResourceSlot{owner,+stamp}:Description{L.ResourceSlot{owner,stamp},[Info{route,key,stamp}]} 21 case L.LayoutPair{ll,rr} Product.Owner{left,right}:described_pair(~S,ll,rr,describe(~S,ll,Routes.append_route(route,L.InLeft{L.AtLeaf{}}),left),describe(~S,rr,Routes.append_route(route,L.InRight{L.AtLeaf{}}),right))