synology_apm_repo.sdk.units.saas.tree_strategy.categorized module

CategorizedGroupTree: a synthetic wrapper layered on top of any other shape in this package whose own root lists named groups — a further synthetic split on top of the two schema shapes every service-level DB in this project expands into.

synology_apm_repo.sdk.units.saas.tree_strategy.categorized.categories_present_in_order(categories, labels)

The distinct category tokens actually used in categories (a member -> category mapping), ordered canonically by labels’ own key order rather than by whichever member was scanned first — dropping an entirely-empty category (e.g. no “Shared Channels” in this workload) is noise, not information, the same reasoning every caller of this applies. Shared by CategorizedGroupTree below and teams_chat.py’s own Standard/Private/Shared channel split, which can’t sit on top of CategorizedGroupTree itself (that class wraps a TreeStrategy, a protocol TeamsChatProvider isn’t built on — it hands out Node values directly) but needs the identical dedup/ordering rule, so a fix to it can’t drift between the two.

class synology_apm_repo.sdk.units.saas.tree_strategy.categorized.CategorizedGroupTree(inner, *, categories, labels)

Bases: object

Wraps any inner TreeStrategy whose own root (children_of(())) lists named groups, adding one extra synthetic level that splits those groups into caller-supplied categories — Site’s Document Library/List split, Calendar’s My Calendars/Other Calendars split. Every key this class hands out or accepts is (category, *inner_key); the wrapped tree only ever sees inner_key, so this works identically regardless of whether the inner tree is flat (NamedGroupFlatTree) or itself recursive within each group (NamedGroupRecursiveTree) — nothing here is specific to either shape.

categories maps each of the inner tree’s own top-level group keys (e.g. a list_id/calendar_id) to a category token; labels maps each category token to its displayed name. Both are computed once by the caller’s own tree_factory (a small, bounded scan of however many groups this workload has), not by this class.

async children_of(key, *, offset=0, limit=None)
row_for(key)