You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(registry): Replace event-driven GC with a lease-based lifecycle (kubernetes-sigs#1476)
* refactor: Reorder methods for logical grouping
Reorganizes the methods in `registry.go` to improve readability and group
related functionality. Public API methods are placed first, followed by
administrative helpers, GC logic, and finally callbacks and statistics
propagation. This is to minimize the delta for subsequent changes.
No logical changes are included in this commit.
* refactor: Simplify managedQueue to a decorator
Removes the complex, stateful signaling mechanism from the
`managedQueue`.
Its sole responsibility is now to decorate a `SafeQueue` with atomic,
strictly consistent statistics tracking.
This change is the foundational first step in moving the registry from a
complex, event-driven lifecycle model to a simpler, lease-based one.
The now-unused event and lifecycle types are also removed.
* refactor: Adapt shard to new managedQueue contract
Updates the `registryShard` to work with the new, signal-free
`managedQueue`.
The shard's responsibility is simplified; it no longer needs to handle
or propagate lifecycle signals from its queues. Its draining logic is
now based on directly checking its aggregate length, removing the need
for the `BecameDrained` signal.
* feat: Replace events lifecycle with leases
Replaces the registry's core lifecycle management system. The complex,
event-driven, actor-based model is removed in favor of a simpler and
more performant lease-based lifecycle.
This commit introduces:
- A new `WithConnection` client API that provides a safe, leak-proof
entry point for managing flow leases via reference counting.
- A per-flow `RWMutex` to provide fine-grained locking, allowing the
garbage collector to operate on one flow without blocking others.
- A simplified GC that periodically scans for flows with a zero lease
count.
Simultaneously, this commit removes the old machinery:
- The central event-processing loop (`Run` is now just for GC).
- The `RegisterOrUpdateFlow` administrative method.
- The entire signaling and event-handling subsystem.
* test: Overhaul tests for new lease-based design
Updates all tests in the registry package to align with the new
lease-based API and simplified component responsibilities.
- `managedqueue_test` is rewritten to focus on stats propagation and
invariants, removing all signal testing.
- `shard_test` is updated to reflect its simpler role and new draining
logic.
- `registry_test` is completely overhauled to test the `WithConnection`
API, JIT registration, and the new lease-based GC logic, using a fake
clock for deterministic lifecycle testing.
0 commit comments