Search in sources :

Example 1 with Bookmark

use of org.neo4j.bolt.runtime.Bookmark in project neo4j by neo4j.

the class TransactionStateMachineV3SPITest method shouldNotCheckDatabaseIdInBookmark.

@Test
void shouldNotCheckDatabaseIdInBookmark() {
    // Given
    var dbSpi = mock(BoltGraphDatabaseServiceSPI.class);
    var spi = new TestAbstractTransactionStateMachineSPI(dbSpi, mock(BoltChannel.class), mock(SystemNanoClock.class), mock(StatementProcessorReleaseManager.class));
    var bookmarks = List.<Bookmark>of(new BookmarkWithPrefix(42L));
    // When
    spi.beginTransaction(null, bookmarks, null, null, null, null);
    // Then
    verify(dbSpi).beginTransaction(any(), any(), any(), eq(bookmarks), any(), any(), any(), any());
}
Also used : BookmarkWithPrefix(org.neo4j.bolt.v3.runtime.bookmarking.BookmarkWithPrefix) StatementProcessorReleaseManager(org.neo4j.bolt.runtime.statemachine.StatementProcessorReleaseManager) SystemNanoClock(org.neo4j.time.SystemNanoClock) Bookmark(org.neo4j.bolt.runtime.Bookmark) BoltChannel(org.neo4j.bolt.BoltChannel) Test(org.junit.jupiter.api.Test)

Example 2 with Bookmark

use of org.neo4j.bolt.runtime.Bookmark in project neo4j by neo4j.

the class TransactionReadyState method processCommitMessage.

private BoltStateMachineState processCommitMessage(StateMachineContext context) throws KernelException {
    StatementProcessor statementProcessor = context.connectionState().getStatementProcessor();
    Bookmark bookmark = statementProcessor.commitTransaction();
    bookmark.attachTo(context.connectionState());
    return readyState;
}
Also used : Bookmark(org.neo4j.bolt.runtime.Bookmark) StatementProcessor(org.neo4j.bolt.runtime.statemachine.StatementProcessor)

Example 3 with Bookmark

use of org.neo4j.bolt.runtime.Bookmark in project neo4j by neo4j.

the class StreamingState method processStreamResultMessage.

@Override
protected BoltStateMachineState processStreamResultMessage(ResultConsumer resultConsumer, StateMachineContext context) throws Throwable {
    int statementId = StatementMetadata.ABSENT_QUERY_ID;
    Bookmark bookmark = context.connectionState().getStatementProcessor().streamResult(statementId, resultConsumer);
    bookmark.attachTo(context.connectionState());
    return readyState;
}
Also used : Bookmark(org.neo4j.bolt.runtime.Bookmark)

Example 4 with Bookmark

use of org.neo4j.bolt.runtime.Bookmark in project neo4j by neo4j.

the class InTransactionState method processCommitMessage.

private BoltStateMachineState processCommitMessage(StateMachineContext context) throws KernelException {
    StatementProcessor statementProcessor = context.connectionState().getStatementProcessor();
    Bookmark bookmark = statementProcessor.commitTransaction();
    bookmark.attachTo(context.connectionState());
    return readyState;
}
Also used : Bookmark(org.neo4j.bolt.runtime.Bookmark) StatementProcessor(org.neo4j.bolt.runtime.statemachine.StatementProcessor)

Example 5 with Bookmark

use of org.neo4j.bolt.runtime.Bookmark in project neo4j by neo4j.

the class AutoCommitState method processStreamResultMessage.

@Override
protected BoltStateMachineState processStreamResultMessage(int statementId, ResultConsumer resultConsumer, StateMachineContext context) throws Throwable {
    Bookmark bookmark = context.connectionState().getStatementProcessor().streamResult(statementId, resultConsumer);
    if (resultConsumer.hasMore()) {
        return this;
    }
    bookmark.attachTo(context.connectionState());
    return readyState;
}
Also used : Bookmark(org.neo4j.bolt.runtime.Bookmark)

Aggregations

Bookmark (org.neo4j.bolt.runtime.Bookmark)8 Test (org.junit.jupiter.api.Test)3 BoltChannel (org.neo4j.bolt.BoltChannel)3 StatementProcessorReleaseManager (org.neo4j.bolt.runtime.statemachine.StatementProcessorReleaseManager)3 SystemNanoClock (org.neo4j.time.SystemNanoClock)3 StatementProcessor (org.neo4j.bolt.runtime.statemachine.StatementProcessor)2 BookmarkWithPrefix (org.neo4j.bolt.v3.runtime.bookmarking.BookmarkWithPrefix)2 ArrayList (java.util.ArrayList)1 BoltIOException (org.neo4j.bolt.messaging.BoltIOException)1 BookmarkWithDatabaseId (org.neo4j.bolt.v4.runtime.bookmarking.BookmarkWithDatabaseId)1 NamedDatabaseId (org.neo4j.kernel.database.NamedDatabaseId)1