Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lwc-events: add pre-filter method for events #1672

Merged
merged 1 commit into from
Jul 10, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ abstract class AbstractLwcEventClient(clock: Clock) extends LwcEventClient {
Query.simplify(q, ignore = true)
}

override def couldMatch(tags: String => String): Boolean = {
index.couldMatch(k => tags(k))
}

override def process(event: LwcEvent): Unit = {
event match {
case LwcEvent.HeartbeatLwcEvent(timestamp) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ import scala.util.Using
*/
trait LwcEventClient {

/**
* Check if an event with a partial set of tags could match one of the expressions.
* This can be used as a pre-filter for cases where an expensive transform is required
* to generate the final event for consideration.
*
* @param tags
* Function that returns the tag value for a given key, or `null` if there is no
* value for that key. This tag set may be a subset of the final set of tags that
* would be on the actual events.
* @return
* True if an event with the partial set of tags might match one of the current
* expressions.
*/
def couldMatch(tags: String => String): Boolean

/**
* Submit an event for a given subscription.
*
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object Dependencies {
val log4j = "2.23.1"
val scala = "2.13.14"
val slf4j = "1.7.36"
val spectator = "1.7.14"
val spectator = "1.7.16"
val spring = "6.1.10"

val crossScala = Seq(scala, "3.4.1")
Expand Down
Loading