Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions core/pkg/store/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const flagSetIdSourceCompoundIndex = flagSetIdIndex + "+" + sourceIndex
const keySourceCompoundIndex = keyIndex + "+" + sourceIndex
const flagSetIdKeySourceCompoundIndex = flagSetIdIndex + "+" + keyIndex + "+" + sourceIndex

// membership table for incremental update deduplication
const membershipTable = "membership"
const membershipFlagSetIdKeyIndex = flagSetIdIndex + "+" + keyIndex

// flagSetId defaults to a UUID generated at startup to make our queries consistent
// any flag without a "flagSetId" is assigned this one; it's never exposed externally
var nilFlagSetId = uuid.New().String()
Expand Down Expand Up @@ -83,6 +87,15 @@ func (s *Selector) IsEmpty() bool {
return s == nil || len(s.indexMap) == 0
}

// HasFlagSetId returns the flagSetId value and true if the selector includes a flagSetId constraint.
func (s *Selector) HasFlagSetId() (string, bool) {
if s == nil || s.indexMap == nil {
return "", false
}
v, ok := s.indexMap[flagSetIdIndex]
return v, ok && v != ""
}

// ToQuery converts the Selector map to an indexId and constraints for querying the Store.
// For a given index, a specific order and number of constraints are required.
// Both the indexId and constraints are generated based on the keys present in the selector's internal map.
Expand Down
Loading
Loading