// AddFaultiness in the FaultySet if not already present
AddFaultiness in the FaultySet if not already present
// AddFaultiness in the FaultySet if not already present
func (fs *FaultySet) AddFaultiness(processID string, round uint64, faultiness Faultiness) {
	fs.mutex.Lock()
	defer fs.mutex.Unlock()
	reasonsForProcess, loaded := fs.faultinessMap[processID]
	if reasonsForProcess == nil || !loaded {
		reasonsForProcess = make(map[uint64]map[Faultiness]struct{})
		fs.faultinessMap[processID] = reasonsForProcess
	}
	reasonsForRound, loaded := reasonsForProcess[round]
	if reasonsForRound == nil || !loaded {
		reasonsForRound = make(map[Faultiness]struct{})
		fs.faultinessMap[processID][round] = reasonsForRound
	}
	_, loaded = reasonsForRound[faultiness]
	if !loaded {
		fs.faultinessMap[processID][round][faultiness] = struct{}{}
	}
}
func ( fs * FaultySet ) AddFaultiness ( processID string , round uint64 , faultiness Faultiness ) { fs . mutex . Lock ( ) defer fs . mutex . Unlock ( ) reasonsForProcess , loaded := fs . faultinessMap [ processID ] if reasonsForProcess == nil || ! loaded { reasonsForProcess = make ( map [ uint64 ] map [ Faultiness ] struct { } ) fs . faultinessMap [ processID ] = reasonsForProcess } reasonsForRound , loaded := reasonsForProcess [ round ] if reasonsForRound == nil || ! loaded { reasonsForRound = make ( map [ Faultiness ] struct { } ) fs . faultinessMap [ processID ] [ round ] = reasonsForRound } _ , loaded = reasonsForRound [ faultiness ] if ! loaded { fs . faultinessMap [ processID ] [ round ] [ faultiness ] = struct { } { } } }
AddFaultiness in the FaultySet if not already present
AddFaultiness in the FaultySet if not already present
// create list of reasons for the process if not present // create list of reasons for the round if not present