Package com.arcadedb.engine
Class WALFile
- java.lang.Object
-
- com.arcadedb.utility.LockContext
-
- com.arcadedb.engine.WALFile
-
public class WALFile extends LockContext
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WALFile.FLUSH_TYPE
static class
WALFile.WALPage
static class
WALFile.WALTransaction
-
Field Summary
Fields Modifier and Type Field Description static long
MAGIC_NUMBER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acquire(Callable<Object> callable)
If the WAL is still active, execute the callback.protected void
append(ByteBuffer buffer)
void
close()
void
drop()
String
getFilePath()
WALFile.WALTransaction
getFirstTransaction()
int
getPendingPagesToFlush()
long
getSize()
Map<String,Object>
getStats()
WALFile.WALTransaction
getTransaction(long pos)
static WALFile.FLUSH_TYPE
getWALFlushType(int txFlushType)
boolean
isOpen()
void
notifyPageFlushed()
void
setActive(boolean active)
String
toString()
static Binary
writeTransactionToBuffer(List<MutablePage> pages, long txId)
void
writeTransactionToFile(DatabaseInternal database, List<MutablePage> pages, WALFile.FLUSH_TYPE sync, WALFile file, long txId, Binary buffer)
-
Methods inherited from class com.arcadedb.utility.LockContext
executeInLock, lock, manageExceptionInLock, unlock
-
-
-
-
Field Detail
-
MAGIC_NUMBER
public static final long MAGIC_NUMBER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WALFile
public WALFile(String filePath) throws FileNotFoundException
- Throws:
FileNotFoundException
-
-
Method Detail
-
close
public void close() throws IOException
- Throws:
IOException
-
isOpen
public boolean isOpen()
-
drop
public void drop() throws IOException
- Throws:
IOException
-
getFirstTransaction
public WALFile.WALTransaction getFirstTransaction() throws WALException
- Throws:
WALException
-
getPendingPagesToFlush
public int getPendingPagesToFlush()
-
acquire
public boolean acquire(Callable<Object> callable)
If the WAL is still active, execute the callback. This avoids closing a file where a thread is still writing to it.- Returns:
- true if acquired, otherwise false
-
setActive
public void setActive(boolean active)
-
getTransaction
public WALFile.WALTransaction getTransaction(long pos)
-
writeTransactionToBuffer
public static Binary writeTransactionToBuffer(List<MutablePage> pages, long txId)
-
writeTransactionToFile
public void writeTransactionToFile(DatabaseInternal database, List<MutablePage> pages, WALFile.FLUSH_TYPE sync, WALFile file, long txId, Binary buffer) throws IOException
- Throws:
IOException
-
notifyPageFlushed
public void notifyPageFlushed()
-
getSize
public long getSize() throws IOException
- Throws:
IOException
-
getFilePath
public String getFilePath()
-
getWALFlushType
public static WALFile.FLUSH_TYPE getWALFlushType(int txFlushType)
-
append
protected void append(ByteBuffer buffer) throws IOException
- Throws:
IOException
-
-