-
Notifications
You must be signed in to change notification settings - Fork 32
feat: add parent selector with connection management and capacity control #1161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…at/parent-selector Signed-off-by: southwest <1403572259@qq.com>
Signed-off-by: southwest <1403572259@qq.com>
Signed-off-by: southwest <1403572259@qq.com>
Signed-off-by: southwest <1403572259@qq.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1161 +/- ##
==========================================
- Coverage 49.33% 48.55% -0.79%
==========================================
Files 58 59 +1
Lines 12114 12311 +197
==========================================
Hits 5977 5977
- Misses 6137 6334 +197
🚀 New features to boost your workflow:
|
id_generator: Arc<IDGenerator>, | ||
|
||
/// hosts_info is the latest host info of different parents. | ||
hosts_info: Arc<DashMap<String, Host>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge hosts_info
and hosts_weights
.
config: Arc<Config>, | ||
|
||
/// active_connections tracks the current number of active connections. | ||
active_connections: Arc<AtomicUsize>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
/// ParentSync manages the synchronization of host information from a parent. | ||
#[derive(Clone)] | ||
struct ParentSync { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this is for.
Description
This PR significantly enhances the parent selector functionality with robust connection management, reference counting, and capacity control mechanisms to improve reliability and resource utilization.
Related Issue
Changes
New Features
Reference Counting
ref_count: Arc<AtomicU32>
to track active tasks using each parentincrement_ref()
anddecrement_ref()
methods for thread-safe reference managementConnection Capacity Control
Arc<AtomicUsize>
Graceful Connection Management
Enhanced Parent Registration/Unregistration
register_parent()
andunregister_parent()
methodsunregister_all_parents()
Improvements
Concurrency Safety
Resource Management
tokio::select!
Technical Details
Data Structures
Key Algorithms
Motivation and Context
Screenshots (if appropriate)