HeimingZ commented on a change in pull request #5320:
URL: https://github.com/apache/iotdb/pull/5320#discussion_r839360129



##########
File path: server/src/main/java/org/apache/iotdb/db/wal/buffer/WALEdit.java
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.iotdb.db.wal.buffer;
+
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.engine.memtable.AbstractMemTable;
+import org.apache.iotdb.db.engine.memtable.IMemTable;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.qp.physical.PhysicalPlan;
+import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
+import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
+import org.apache.iotdb.db.wal.utils.SerializedSize;
+import org.apache.iotdb.db.wal.utils.WALMode;
+import org.apache.iotdb.db.wal.utils.listener.WALFlushListener;
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.util.Objects;
+
+/**
+ * WALEdit is the basic element of .wal file, including type, memTable id, and 
specific
+ * value(physical plan or memTable snapshot).
+ */
+public class WALEdit implements SerializedSize {
+  private static final IoTDBConfig config = 
IoTDBDescriptor.getInstance().getConfig();
+
+  /** wal edit type 1 byte, memTable id 4 bytes */
+  private static final int FIXED_SERIALIZED_SIZE = Byte.BYTES + Integer.BYTES;
+
+  /** type of value */
+  private final WALEditType type;
+  /** memTable id */
+  private final int memTableId;
+  /** value(physical plan or memTable snapshot) */
+  private final WALEditValue value;
+
+  /**
+   * listen whether this WALEdit has been written to the filesystem, null iff 
this WALEdit is
+   * deserialized from .wal file
+   */
+  private final WALFlushListener walFlushListener;
+
+  public WALEdit(int memTableId, WALEditValue value) {
+    this(memTableId, value, config.getWalMode() == WALMode.SYNC);
+  }
+
+  public WALEdit(int memTableId, WALEditValue value, boolean wait) {

Review comment:
       For WALEdit, it also has another constuctor to construct a waiting 
WALResultListener.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to