ResourceScopeImpl constructor

ResourceScopeImpl(
  1. Limit limit,
  2. String name, {
  3. ResourceScopeImpl? owner,
  4. List<ResourceScopeImpl>? edges,
})

Implementation

ResourceScopeImpl(Limit limit, this.name,
    {ResourceScopeImpl? owner, List<ResourceScopeImpl>? edges}) // Changed back to edges
    : _resources = _Resources(limit),
      _owner = owner,
      this.edges = edges ?? [] {
  // if (limit is BaseLimit) {
  //   print('DEBUG: ResourceScopeImpl created: $name with BaseLimit: streams=${limit.streamTotalLimit}, In=${limit.getStreamLimit(Direction.inbound)}, Out=${limit.getStreamLimit(Direction.outbound)}');
  // } else {
  //   print('DEBUG: ResourceScopeImpl created: $name with limit type: ${limit.runtimeType}');
  // }
  if (_owner == null) {
    // This is a DAG scope, increment ref count of its parents
    for (var edge in this.edges) { // Use public field via 'this' for clarity
      edge.incRef();
    }
  }
  // If it's a span, owner's ref count is handled by beginSpan
  // log.debug('Scope created: $name, Owner: ${_owner?.name}, Edges: ${_edges.map((e) => e.name)}');
}