All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.neo4j.kernel.impl.transaction.log.TransactionAppender Maven / Gradle / Ivy

Go to download

Neo4j kernel is a lightweight, embedded Java database designed to store data structured as graphs rather than tables. For more information, see http://neo4j.org.

There is a newer version: 5.25.1
Show newest version
/*
 * Copyright (c) "Neo4j"
 * Neo4j Sweden AB [http://neo4j.com]
 *
 * This file is part of Neo4j.
 *
 * Neo4j is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */
package org.neo4j.kernel.impl.transaction.log;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

import org.neo4j.io.pagecache.context.CursorContext;
import org.neo4j.kernel.impl.api.TransactionToApply;
import org.neo4j.kernel.impl.transaction.tracing.LogAppendEvent;
import org.neo4j.kernel.lifecycle.Lifecycle;
import org.neo4j.monitoring.DatabaseHealth;
import org.neo4j.storageengine.api.TransactionIdStore;

/**
 * Writes batches of transactions, each containing groups of commands to a log that is guaranteed to be recoverable,
 * i.e. consistently readable, in the event of failure.
 */
public interface TransactionAppender extends Lifecycle
{
    /**
     * Appends a batch of transactions to a log, effectively committing the transactions.
     * After this method have returned the returned transaction id should be visible in
     * {@link TransactionIdStore#getLastCommittedTransactionId()}.
     * 

* Any failure happening inside this method will cause a {@link DatabaseHealth#panic(Throwable) kernel panic}. * Callers must make sure that successfully appended * transactions exiting this method are {@link Commitment#publishAsClosed(CursorContext)}. * * @param batch transactions to append to the log. These transaction instances provide both input arguments * as well as a place to provide output data, namely {@link TransactionToApply#commitment(Commitment, long)} and * {@link TransactionToApply#transactionId()}. * @param logAppendEvent A trace event for the given log append operation. * @return last committed transaction in this batch. The appended (i.e. committed) transactions * will have had their {@link TransactionToApply#commitment(Commitment, long)} available and caller is expected to * {@link Commitment#publishAsClosed(CursorContext)} mark them as applied} after they have been applied to storage. * Note that {@link Commitment commitments} must be {@link Commitment#publishAsCommitted(CursorContext)} marked as committed} * by this method. * @throws IOException if there was a problem appending the transaction. See method javadoc body for * how to handle exceptions in general thrown from this method. */ long append( TransactionToApply batch, LogAppendEvent logAppendEvent ) throws IOException, ExecutionException, InterruptedException; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy