Skip to content

Commit 018d121

Browse files
committed
feat: add Enumerate method to RouteTable for efficient route enumeration
- Provide a lightweight alternative to `GetAll` by introducing `Enumerate` for on-demand route enumeration without allocating a snapshot list.
1 parent 4612f66 commit 018d121

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

BGPLite.Routing/RouteTable.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public bool Remove(uint prefix, byte length) =>
2626
public IReadOnlyList<Route> GetAll() =>
2727
_routes.Values.ToList();
2828

29+
/// <summary>Enumerates current routes without materializing a snapshot list (one allocation fewer than GetAll).</summary>
30+
public IEnumerable<Route> Enumerate() => _routes.Values;
31+
2932
public void Clear() =>
3033
_routes.Clear();
3134
}

0 commit comments

Comments
 (0)