You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/09/10 16:48:08 UTC

[GitHub] [cassandra-in-jvm-dtest-api] yifan-c commented on a change in pull request #17: CASSANDRA-16120 - Add ability for jvm-dtest to grep instance logs

yifan-c commented on a change in pull request #17:
URL: https://github.com/apache/cassandra-in-jvm-dtest-api/pull/17#discussion_r486489279



##########
File path: src/main/java/org/apache/cassandra/distributed/api/LogAction.java
##########
@@ -0,0 +1,352 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.distributed.api;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public interface LogAction
+{
+    /**
+     * @return current position of the iterator
+     * @see LogAction#grep(long, String)
+     * @see LogAction#watchFor(long, String)
+     */
+    long mark();
+
+    LineIterator matching(long startPosition, Predicate<String> fn);
+
+    default LineIterator matching(Predicate<String> fn){
+        return matching(Internal.DEFAULT_START_POSITION, fn);
+    }
+
+    default List<String> watchFor(long startPosition, Duration timeout, Predicate<String> fn) throws TimeoutException

Review comment:
       For what it is worth, the following APIs (watchFor variants) could be helpful as well. 
   
   Within the timeout,
   - expect such kind of message/pattern to appear for exact N times. 
   - expect such kind of message/pattern to appear for at least N times. 
   - expect no such message/pattern




----------------------------------------------------------------
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



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