cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [cassandra] dcapwell commented on a change in pull request #428: CASSANDRA-15505
Date Wed, 29 Jan 2020 18:19:53 GMT
dcapwell commented on a change in pull request #428: CASSANDRA-15505 
URL: https://github.com/apache/cassandra/pull/428#discussion_r372542106
 
 

 ##########
 File path: test/distributed/org/apache/cassandra/distributed/impl/MessageFilters.java
 ##########
 @@ -19,28 +19,23 @@
 package org.apache.cassandra.distributed.impl;
 
 import java.util.Arrays;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
 
-import org.apache.cassandra.distributed.api.IInstance;
+import org.apache.cassandra.distributed.api.IMessage;
 import org.apache.cassandra.distributed.api.IMessageFilters;
-import org.apache.cassandra.net.Verb;
 
 public class MessageFilters implements IMessageFilters
 {
-    private final Set<Filter> filters = new CopyOnWriteArraySet<>();
+    private final List<Filter> filters = new CopyOnWriteArrayList<>();
 
-    public boolean permit(IInstance from, IInstance to, int verb)
+    public boolean permit(int from, int to, IMessage msg)
     {
-        if (from == null || to == null)
-            return false; // cannot deliver
-        int fromNum = from.config().num();
-        int toNum = to.config().num();
-
         for (Filter filter : filters)
-            if (filter.matches(fromNum, toNum, verb))
-                return false;
-
+        {
+            if (filter.matches(from, to, msg))
+                return filter.permitIfMatched;
 
 Review comment:
   this feels weird to me; if I have the following
   
   ```
   filter(verb).pass();
   filter(verb).drop();
   ```
   
   what happens?  It looks like the drop will be skipped in favor of pass.  Don't see a test
for this since each test calls `filters.reset();` before adding the second filter.
   
   The pass/drop stuff already exists so nothing for this PR, but I feel that `pass()` should
be removed (should file jira for this)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message