Github user pwendell commented on a diff in the pull request:
https://github.com/apache/spark/pull/5645#discussion_r29209731
--- Diff:
streaming/src/main/java/org/apache/spark/streaming/util/WriteAheadLog.java ---
@@ -0,0 +1,59 @@
+/*
+ * 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.spark.streaming.util;
+
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+
+/**
+ * Interface representing a write ahead log (aka journal) that is used by
Spark Streaming to
+ * save the received data (by receivers) and associated metadata to a
reliable storage, so that
+ * they can be recovered after driver failures. See the Spark docs for
more information on how
+ * to plug in your own custom implementation of a write ahead log.
+ */
[email protected]
+public interface WriteAheadLog {
+ /**
+ * Write the record to the log and return the segment information that
is necessary to read
+ * back the written record. The time is used to the index the record,
such that it can be
+ * cleaned later. Note that the written data must be durable and
readable (using the
+ * segment info) by the time this function returns.
+ */
+ WriteAheadLogSegment write(ByteBuffer record, long time);
+
+ /**
+ * Read a written record based on the given segment information.
+ */
+ ByteBuffer read(WriteAheadLogSegment segment);
+
+ /**
+ * Read and return an iterator of all the records that have written and
not yet cleanup.
+ */
+ Iterator<ByteBuffer> readAll();
+
+ /**
+ * Cleanup all the records that are older than the given threshold time.
It can wait for
+ * the completion of the deletion.
+ */
+ void cleanup(long threshTime, boolean waitForCompletion);
--- End diff --
For some reason I feel like it should just be "clean" instead of "cleanup"
(as in "log cleaning"). This is totally subjective though so I think the
current one is OK to.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]