Publisher: chaining sub-collections
// One level down: the per-host atSigns sub-collection.
final atsigns = nodes.subCollection<AtsignOnHost>(
parent: hostItem, subName: 'atsigns', defaultExpiration: ttl,
);
final atSignItem = await atsigns.upsert(
id: atSignId,
obj: AtsignOnHost(atSign: s.atSign, hostname: s.hostname, firstSeenMs: now),
sharedWith: otherAtSigns,
);
// Two levels down: the per-(host, atSign) samples leaf collection.
final samples = atsigns.subCollection<StatSample>(
parent: atSignItem, subName: 'samples', defaultExpiration: ttl,
);
await samples.create(
id: s.millis.toString(), obj: s, sharedWith: otherAtSigns,
);
subCollection<U> returns another AtCollection<U>, fully typed, with the same verbs.
- The composed namespace and its 255-char budget are enforced at construction time.
- The pattern composes: any
CItem can host another sub.