Interface SubscriptionFilterMatcher

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SubscriptionFilterMatcher
Evaluates the repeated SubscriptionFilter filters field of a SubscribeRequest against a Persistent Query (PQ).

An empty filter list matches every PQ. A non-empty filter list is OR-combined: a PQ matches iff at least one filter element matches it, either by serial or by (owner, name) pair.

The same logic is used on the server (to decide what to emit) and on the client (to defend against an older server that ignored the filter field). See the proto comment on SubscribeRequest.filters for the full backwards-compatibility contract.

This is a FunctionalInterface: the sole abstract method is matches(long, java.lang.String, java.lang.String). Instances are obtained from fromProto(java.util.List<io.deephaven.proto.controller.SubscriptionFilter>) (or the MATCH_ALL constant), never constructed directly.

  • Field Details

  • Method Details

    • matches

      boolean matches(long serial, @NotNull @NotNull String owner, @NotNull @NotNull String name)
      Test whether a PQ identified by its serial, owner and name matches this filter.
    • isMatchAll

      static boolean isMatchAll(@NotNull @NotNull SubscriptionFilterMatcher matcher)
      Parameters:
      matcher - the matcher to test
      Returns:
      true if the matcher accepts every PQ (i.e. was built from an empty filter list).
    • fromProto

      static SubscriptionFilterMatcher fromProto(@Nullable @Nullable List<SubscriptionFilter> filters)
      Build a matcher from a list of SubscriptionFilter proto messages.
      Parameters:
      filters - the filter list from SubscribeRequest.getFiltersList(); may be null or empty
      Returns:
      a matcher; MATCH_ALL if the list is null or empty
      Throws:
      IllegalArgumentException - if any element is malformed (no oneof variant set, or OwnerAndName with empty owner or empty name). Callers handling a gRPC request should translate this to Status.INVALID_ARGUMENT.