Package org.apache.iotdb.db.wal.buffer
Class WALBuffer
- java.lang.Object
-
- org.apache.iotdb.db.wal.buffer.AbstractWALBuffer
-
- org.apache.iotdb.db.wal.buffer.WALBuffer
-
- All Implemented Interfaces:
java.lang.AutoCloseable,IWALBuffer
public class WALBuffer extends AbstractWALBuffer
This buffer guarantees the concurrent safety and uses double buffers mechanism to accelerate writes and avoid waiting for buffer syncing to disk.
-
-
Field Summary
Fields Modifier and Type Field Description protected WALFileStatuscurrentFileStatusfile status of working buffer, updating file writer's status when syncing-
Fields inherited from class org.apache.iotdb.db.wal.buffer.AbstractWALBuffer
currentSearchIndex, currentWALFileVersion, currentWALFileWriter, identifier, logDirectory
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanisAllWALEntriesConsumed()voidwaitForFlush()Wait for next flush operation donebooleanwaitForFlush(long time, java.util.concurrent.TimeUnit unit)Wait for next flush operation donevoidwrite(WALEntry walEntry)Write WALEntry into wal buffer.-
Methods inherited from class org.apache.iotdb.db.wal.buffer.AbstractWALBuffer
getCurrentSearchIndex, getCurrentWALFileSize, getCurrentWALFileVersion, rollLogWriter
-
-
-
-
Field Detail
-
currentFileStatus
protected volatile WALFileStatus currentFileStatus
file status of working buffer, updating file writer's status when syncing
-
-
Constructor Detail
-
WALBuffer
public WALBuffer(java.lang.String identifier, java.lang.String logDirectory) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
WALBuffer
public WALBuffer(java.lang.String identifier, java.lang.String logDirectory, long startFileVersion, long startSearchIndex) throws java.io.FileNotFoundException- Throws:
java.io.FileNotFoundException
-
-
Method Detail
-
write
public void write(WALEntry walEntry)
Description copied from interface:IWALBufferWrite WALEntry into wal buffer.- Parameters:
walEntry- info will be written into wal buffer
-
waitForFlush
public void waitForFlush() throws java.lang.InterruptedExceptionDescription copied from interface:IWALBufferWait for next flush operation done- Throws:
java.lang.InterruptedException
-
waitForFlush
public boolean waitForFlush(long time, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedExceptionDescription copied from interface:IWALBufferWait for next flush operation done- Throws:
java.lang.InterruptedException
-
close
public void close()
-
isAllWALEntriesConsumed
public boolean isAllWALEntriesConsumed()
-
-