Documentation for Distcandidateselector Module¶
DistanceCandidateSelector
¶
Bases: CandidateSelector
Selects candidate nodes based on their physical proximity.
This selector uses geolocation data to filter candidates within a maximum distance threshold. It listens for GPS updates and maintains a mapping of node identifiers to their distances and coordinates.
Attributes:
Name | Type | Description |
---|---|---|
MAX_DISTANCE_THRESHOLD |
int
|
Maximum distance (in meters) allowed for a node to be considered a valid candidate. |
candidates |
list
|
List of candidate nodes to be evaluated. |
candidates_lock |
Locker
|
Async lock for managing concurrent access to the candidate list. |
nodes_distances |
dict
|
Maps node IDs to a tuple containing the distance and GPS coordinates. |
nodes_distances_lock |
Locker
|
Async lock for the distance mapping. |
_verbose |
bool
|
Flag to enable verbose logging for debugging. |
Methods:
Name | Description |
---|---|
set_config |
Subscribes to GPS events for distance updates. |
add_candidate |
Adds a new candidate to the list. |
select_candidates |
Returns candidates within the allowed distance. |
remove_candidates |
Clears the candidate list. |
any_candidate |
Returns True if there is at least one candidate. |
Inherits from
CandidateSelector: Base class interface for candidate selection logic.
Source code in nebula/core/situationalawareness/discovery/candidateselection/distcandidateselector.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|