This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from weaveworks/filter-exact
Fix the filtering framework to perform exact matches again
- Loading branch information
Showing
9 changed files
with
1,531 additions
and
1,467 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
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
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
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,38 @@ | ||
package filterer | ||
|
||
import ( | ||
meta "github.com/weaveworks/ignite/pkg/apis/meta/v1alpha1" | ||
) | ||
|
||
// Match describes the result of filtering an Object | ||
// If the Object to be filtered didn't match, return nil | ||
type Match interface { | ||
// Get the matched Object | ||
Object() meta.Object | ||
// Check if the match was exact | ||
Exact() bool | ||
} | ||
|
||
// GenericMatch is the simplest implementation | ||
// of Match, carrying no additional data | ||
type GenericMatch struct { | ||
object meta.Object | ||
exact bool | ||
} | ||
|
||
var _ Match = &GenericMatch{} | ||
|
||
func NewMatch(object meta.Object, exact bool) *GenericMatch { | ||
return &GenericMatch{ | ||
object: object, | ||
exact: exact, | ||
} | ||
} | ||
|
||
func (m *GenericMatch) Object() meta.Object { | ||
return m.object | ||
} | ||
|
||
func (m *GenericMatch) Exact() bool { | ||
return m.exact | ||
} |
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