Documentation ¶
Index ¶
- Constants
- func CumulativeProbabilityFunctionForPoissonDist(k_events uint64, lambda float64) float64
- type ConcurrentBlockStore
- type ProviderData
- type ProviderOptimizer
- func (po *ProviderOptimizer) AppendProbeRelayData(providerAddress string, latency time.Duration, success bool)
- func (po *ProviderOptimizer) AppendRelayData(providerAddress string, latency time.Duration, isHangingApi bool, ...)
- func (po *ProviderOptimizer) AppendRelayFailure(providerAddress string)
- func (po *ProviderOptimizer) CalculateProbabilityOfBlockError(requestedBlock int64, providerData ProviderData) float64
- func (po *ProviderOptimizer) CalculateProbabilityOfTimeout(availabilityScore score.ScoreStore) float64
- func (po *ProviderOptimizer) ChooseProvider(allAddresses []string, ignoredProviders map[string]struct{}, cu uint64, ...) (addresses []string)
- func (po *ProviderOptimizer) GetExcellenceQoSReportForProvider(providerAddress string) *pairingtypes.QualityOfServiceReport
- func (po *ProviderOptimizer) Strategy() Strategy
- type Strategy
Constants ¶
View Source
const ( CacheMaxCost = 2000 // each item cost would be 1 CacheNumCounters = 20000 // expect 2000 items INITIAL_DATA_STALENESS = 24 HALF_LIFE_TIME = time.Hour MAX_HALF_TIME = 3 * time.Hour PROBE_UPDATE_WEIGHT = 0.25 RELAY_UPDATE_WEIGHT = 1 DEFAULT_EXPLORATION_CHANCE = 0.1 COST_EXPLORATION_CHANCE = 0.01 WANTED_PRECISION = int64(8) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConcurrentBlockStore ¶
type ProviderData ¶
type ProviderData struct { Availability score.ScoreStore // will be used to calculate the probability of error Latency score.ScoreStore // will be used to calculate the latency score Sync score.ScoreStore // will be used to calculate the sync score for spectypes.LATEST_BLOCK/spectypes.NOT_APPLICABLE requests SyncBlock uint64 // will be used to calculate the probability of block error }
type ProviderOptimizer ¶
type ProviderOptimizer struct {
// contains filtered or unexported fields
}
func NewProviderOptimizer ¶
func NewProviderOptimizer(strategy Strategy, averageBlockTIme, baseWorldLatency time.Duration, wantedNumProvidersInConcurrency uint) *ProviderOptimizer
func (*ProviderOptimizer) AppendProbeRelayData ¶
func (po *ProviderOptimizer) AppendProbeRelayData(providerAddress string, latency time.Duration, success bool)
func (*ProviderOptimizer) AppendRelayData ¶
func (*ProviderOptimizer) AppendRelayFailure ¶
func (po *ProviderOptimizer) AppendRelayFailure(providerAddress string)
func (*ProviderOptimizer) CalculateProbabilityOfBlockError ¶
func (po *ProviderOptimizer) CalculateProbabilityOfBlockError(requestedBlock int64, providerData ProviderData) float64
func (*ProviderOptimizer) CalculateProbabilityOfTimeout ¶
func (po *ProviderOptimizer) CalculateProbabilityOfTimeout(availabilityScore score.ScoreStore) float64
func (*ProviderOptimizer) ChooseProvider ¶
func (po *ProviderOptimizer) ChooseProvider(allAddresses []string, ignoredProviders map[string]struct{}, cu uint64, requestedBlock int64, perturbationPercentage float64) (addresses []string)
returns a sub set of selected providers according to their scores, perturbation factor will be added to each score in order to randomly select providers that are not always on top
func (*ProviderOptimizer) GetExcellenceQoSReportForProvider ¶
func (po *ProviderOptimizer) GetExcellenceQoSReportForProvider(providerAddress string) *pairingtypes.QualityOfServiceReport
func (*ProviderOptimizer) Strategy ¶
func (po *ProviderOptimizer) Strategy() Strategy
Click to show internal directories.
Click to hide internal directories.