filters

package
v3.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateMixFilterSlots

func CalculateMixFilterSlots(mixFilters []Filter, slotCount int) (mixFiltersIndexes map[Filter][]int)

this function calculates which slot indexes should be filtered by what filters when mix filtering it divides the mix filters to batches where one batch is always empty and the rest contain one or more mix filters in case there are too many mix filters the batches grow in the amount of filters, in case there are less mix filters than slots, each batch will contain only one filter

func SetupScores

func SetupScores(ctx sdk.Context, filters []Filter, providers []epochstoragetypes.StakeEntry, strictestPolicy *planstypes.Policy, currentEpoch uint64, slotCount int, cluster string, qg pairingscores.QosGetter) ([]*pairingscores.PairingScore, error)

Types

type AddonFilter

type AddonFilter struct {
	// contains filtered or unexported fields
}

func (*AddonFilter) Filter

func (f *AddonFilter) Filter(ctx sdk.Context, providers []epochstoragetypes.StakeEntry, currentEpoch uint64) []bool

func (*AddonFilter) InitFilter

func (f *AddonFilter) InitFilter(strictestPolicy planstypes.Policy) (bool, []Filter)

func (*AddonFilter) IsMix

func (f *AddonFilter) IsMix() bool

type Filter

type Filter interface {
	Filter(ctx sdk.Context, providers []epochstoragetypes.StakeEntry, currentEpoch uint64) []bool
	InitFilter(strictestPolicy planstypes.Policy) (active bool, subMixFilters []Filter) // return if filter is usable (by the policy) and mix filters
	IsMix() bool
}

Note, the only filter that is divided to additional sub filters is the addon filter. When the policy defines the MIX selected providers mode, we look at the total requirements of the policy for addon\extensions divide them. Let's assume the policy defines the pairing should have providers that support the "archive" addon and the "debug" and "trace" extensions combined. So the addon filter will filter providers that are not supporting the whole combination, but if the selected providers mode is MIX, we create additional mix filters that filter providers by the defined addons and extensions separately. In this example, the new filters will be a filter with "archive" only, filter with "debug" only and filter with "trace" only.

func GetAllFilters

func GetAllFilters() []Filter

type FrozenProvidersFilter

type FrozenProvidersFilter struct{}

func (*FrozenProvidersFilter) Filter

func (f *FrozenProvidersFilter) Filter(ctx sdk.Context, providers []epochstoragetypes.StakeEntry, currentEpoch uint64) []bool

func (*FrozenProvidersFilter) InitFilter

func (f *FrozenProvidersFilter) InitFilter(strictestPolicy planstypes.Policy) (bool, []Filter)

func (*FrozenProvidersFilter) IsMix

func (f *FrozenProvidersFilter) IsMix() bool

type GeolocationFilter

type GeolocationFilter struct {
	// contains filtered or unexported fields
}

func (*GeolocationFilter) Filter

func (f *GeolocationFilter) Filter(ctx sdk.Context, providers []epochstoragetypes.StakeEntry, currentEpoch uint64) []bool

func (*GeolocationFilter) InitFilter

func (f *GeolocationFilter) InitFilter(strictestPolicy planstypes.Policy) (bool, []Filter)

func (*GeolocationFilter) IsMix

func (f *GeolocationFilter) IsMix() bool

type SelectedProvidersFilter

type SelectedProvidersFilter struct {
	// contains filtered or unexported fields
}

func (*SelectedProvidersFilter) Filter

func (f *SelectedProvidersFilter) Filter(ctx sdk.Context, providers []epochstoragetypes.StakeEntry, currentEpoch uint64) []bool

func (*SelectedProvidersFilter) InitFilter

func (f *SelectedProvidersFilter) InitFilter(strictestPolicy planstypes.Policy) (bool, []Filter)

func (*SelectedProvidersFilter) IsMix

func (f *SelectedProvidersFilter) IsMix() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL