Documentation ¶
Overview ¶
Package failured implements the Adaptive Accrual Failure Detector
This package implements [A New Adaptive Accrual Failure Detector for Dependable Distributed Systems](https://dl.acm.org/citation.cfm?id=1244129)
To use the failure detector, you need a heartbeat loop that will call RegisterHeartbeat() at regular intervals. At any point, you can call FailureProbability() which will report the suspicion level since the last time RegisterHeartbeat() was called.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultConfig is the default Detector Config. DefaultConfig = Config{ WindowSize: 1000, Factor: 0.9, FailureThreshold: 0.5, } )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // max size of inter-arrival time list WindowSize uint64 // a scaling factor Factor float64 FailureThreshold float64 }
Config used to init Detector.
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
Detector is a failure detector.
func (*Detector) CheckFailure ¶
CheckFailure returns true if `FailureProbability` is equal to or higher than `FailureThreshold`. `now` is the current time in Microseconds.
func (*Detector) FailureProbability ¶
FailureProbability calculates the suspicion level at time `now` that the remote end has failed. `now` is the current time in Milliseconds, default to time.Now() in Milliseconds.
func (*Detector) RegisterHeartbeat ¶
RegisterHeartbeat registers a heartbeat at time `now`. `now` is the time in Milliseconds at which the heartbeat was received, default to time.Now() in Milliseconds.