Search in sources :

Example 1 with TransactionIntentLog

use of org.sirix.cache.TransactionIntentLog in project sirix by sirixdb.

the class PageWriteTrxImpl method createTrxIntentLog.

private TransactionIntentLog createTrxIntentLog(final XdmResourceManager resourceManager) {
    final Path logFile = resourceManager.getResourceConfig().mPath.resolve("log").resolve("intent-log");
    try {
        if (Files.exists(logFile)) {
            Files.delete(logFile);
            Files.createFile(logFile);
        }
        final RandomAccessFile file = new RandomAccessFile(logFile.toFile(), "rw");
        final FileWriter fileWriter = new FileWriter(file, new ByteHandlePipeline(resourceManager.getResourceConfig().mByteHandler), SerializationType.TRANSACTION_INTENT_LOG);
        final PersistentFileCache persistentFileCache = new PersistentFileCache(fileWriter, this);
        return new TransactionIntentLog(persistentFileCache);
    } catch (final IOException e) {
        throw new UncheckedIOException(e);
    }
}
Also used : Path(java.nio.file.Path) RandomAccessFile(java.io.RandomAccessFile) FileWriter(org.sirix.io.file.FileWriter) UncheckedIOException(java.io.UncheckedIOException) ByteHandlePipeline(org.sirix.io.bytepipe.ByteHandlePipeline) SirixIOException(org.sirix.exception.SirixIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) PersistentFileCache(org.sirix.cache.PersistentFileCache) TransactionIntentLog(org.sirix.cache.TransactionIntentLog)

Aggregations

IOException (java.io.IOException)1 RandomAccessFile (java.io.RandomAccessFile)1 UncheckedIOException (java.io.UncheckedIOException)1 Path (java.nio.file.Path)1 PersistentFileCache (org.sirix.cache.PersistentFileCache)1 TransactionIntentLog (org.sirix.cache.TransactionIntentLog)1 SirixIOException (org.sirix.exception.SirixIOException)1 ByteHandlePipeline (org.sirix.io.bytepipe.ByteHandlePipeline)1 FileWriter (org.sirix.io.file.FileWriter)1