forked from lavanet/lava
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CNS-213: created templates for filter code
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package filters | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
epochstoragetypes "github.com/lavanet/lava/x/epochstorage/types" | ||
projectstypes "github.com/lavanet/lava/x/projects/types" | ||
) | ||
|
||
type Filter interface { | ||
Filter(ctx sdk.Context, stakeEntry []epochstoragetypes.StakeEntry) []bool | ||
InitFilter(strictestPolicy projectstypes.Policy) bool // return if filter is usable (by the policy) | ||
} | ||
|
||
func GetAllFilters() []Filter { | ||
var selectedProvidersFilter SelectedProvidersFilter | ||
var frozenProvidersFilter FrozenProvidersFilter | ||
|
||
filters := []Filter{&selectedProvidersFilter, &frozenProvidersFilter} | ||
return filters | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package filters | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
epochstoragetypes "github.com/lavanet/lava/x/epochstorage/types" | ||
projectstypes "github.com/lavanet/lava/x/projects/types" | ||
) | ||
|
||
type FrozenProvidersFilter struct{} | ||
|
||
func (*FrozenProvidersFilter) Filter(ctx sdk.Context, stakeEntry []epochstoragetypes.StakeEntry) []bool { | ||
return nil | ||
} | ||
|
||
func (*FrozenProvidersFilter) InitFilter(strictestPolicy projectstypes.Policy) bool { | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package filters | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
epochstoragetypes "github.com/lavanet/lava/x/epochstorage/types" | ||
projectstypes "github.com/lavanet/lava/x/projects/types" | ||
) | ||
|
||
type SelectedProvidersFilter struct { | ||
selectedProviders []epochstoragetypes.StakeEntry | ||
} | ||
|
||
func (*SelectedProvidersFilter) Filter(ctx sdk.Context, stakeEntry []epochstoragetypes.StakeEntry) []bool { | ||
return nil | ||
} | ||
|
||
func (*SelectedProvidersFilter) InitFilter(strictestPolicy projectstypes.Policy) bool { | ||
return false | ||
} |