Skip to content

Documentation for Fccandidateselector Module

FCCandidateSelector

Bases: CandidateSelector

Source code in nebula/core/situationalawareness/discovery/candidateselection/fccandidateselector.py
 5
 6
 7
 8
 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
class FCCandidateSelector(CandidateSelector):
    def __init__(self):
        self.candidates = []
        self.candidates_lock = Locker(name="candidates_lock")

    async def set_config(self, config):
        pass

    async def add_candidate(self, candidate):
        self.candidates_lock.acquire()
        self.candidates.append(candidate)
        self.candidates_lock.release()

    async def select_candidates(self):
        """
        In Fully-Connected topology all candidates should be selected
        """
        self.candidates_lock.acquire()
        cdts = self.candidates.copy()
        self.candidates_lock.release()
        return (cdts, [])

    async def remove_candidates(self):
        self.candidates_lock.acquire()
        self.candidates = []
        self.candidates_lock.release()

    async def any_candidate(self):
        self.candidates_lock.acquire()
        any = True if len(self.candidates) > 0 else False
        self.candidates_lock.release()
        return any

select_candidates() async

In Fully-Connected topology all candidates should be selected

Source code in nebula/core/situationalawareness/discovery/candidateselection/fccandidateselector.py
18
19
20
21
22
23
24
25
async def select_candidates(self):
    """
    In Fully-Connected topology all candidates should be selected
    """
    self.candidates_lock.acquire()
    cdts = self.candidates.copy()
    self.candidates_lock.release()
    return (cdts, [])