Search in sources :

Example 1 with StatementMetadata

use of org.neo4j.bolt.runtime.statemachine.StatementMetadata in project neo4j by neo4j.

the class ProcedureRoutingTableGetter method get.

@Override
public CompletableFuture<MapValue> get(StatementProcessor statementProcessor, MapValue routingContext, List<Bookmark> bookmarks, String databaseName) {
    var params = getParams(routingContext, databaseName);
    var future = new CompletableFuture<MapValue>();
    try {
        StatementMetadata statementMetadata = statementProcessor.run(GET_ROUTING_TABLE_STATEMENT, params, bookmarks, null, AccessMode.READ, Map.of());
        statementProcessor.streamResult(statementMetadata.queryId(), new RoutingTableConsumer(future));
    } catch (Throwable throwable) {
        future.completeExceptionally(throwable);
    }
    return future;
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) StatementMetadata(org.neo4j.bolt.runtime.statemachine.StatementMetadata)

Example 2 with StatementMetadata

use of org.neo4j.bolt.runtime.statemachine.StatementMetadata in project neo4j by neo4j.

the class TransactionStateMachine method run.

@Override
public StatementMetadata run(String statement, MapValue params, List<Bookmark> bookmarks, Duration txTimeout, AccessMode accessMode, Map<String, Object> txMetaData) throws KernelException {
    state = state.run(ctx, spi, statement, params, bookmarks, txTimeout, accessMode, txMetaData);
    StatementMetadata metadata = ctx.lastStatementMetadata;
    // metadata should not be needed more than once
    ctx.lastStatementMetadata = null;
    return metadata;
}
Also used : StatementMetadata(org.neo4j.bolt.runtime.statemachine.StatementMetadata)

Example 3 with StatementMetadata

use of org.neo4j.bolt.runtime.statemachine.StatementMetadata in project neo4j by neo4j.

the class ReadyState method processRunMessage.

private BoltStateMachineState processRunMessage(RunMessage message, StateMachineContext context) throws Exception {
    long start = context.clock().millis();
    StatementProcessor statementProcessor = getStatementProcessor(message, context);
    StatementMetadata statementMetadata = statementProcessor.run(message.statement(), message.params(), message.bookmarks(), message.transactionTimeout(), message.getAccessMode(), message.transactionMetadata());
    long end = context.clock().millis();
    context.connectionState().onMetadata(FIELDS_KEY, stringArray(statementMetadata.fieldNames()));
    context.connectionState().onMetadata(FIRST_RECORD_AVAILABLE_KEY, Values.longValue(end - start));
    return streamingState;
}
Also used : StatementProcessor(org.neo4j.bolt.runtime.statemachine.StatementProcessor) StatementMetadata(org.neo4j.bolt.runtime.statemachine.StatementMetadata)

Example 4 with StatementMetadata

use of org.neo4j.bolt.runtime.statemachine.StatementMetadata in project neo4j by neo4j.

the class TransactionReadyState method processRunMessage.

private BoltStateMachineState processRunMessage(RunMessage message, StateMachineContext context) throws KernelException {
    long start = context.clock().millis();
    StatementProcessor statementProcessor = context.connectionState().getStatementProcessor();
    StatementMetadata statementMetadata = statementProcessor.run(message.statement(), message.params());
    long end = context.clock().millis();
    context.connectionState().onMetadata(FIELDS_KEY, stringArray(statementMetadata.fieldNames()));
    context.connectionState().onMetadata(FIRST_RECORD_AVAILABLE_KEY, Values.longValue(end - start));
    return streamingState;
}
Also used : StatementProcessor(org.neo4j.bolt.runtime.statemachine.StatementProcessor) StatementMetadata(org.neo4j.bolt.runtime.statemachine.StatementMetadata)

Example 5 with StatementMetadata

use of org.neo4j.bolt.runtime.statemachine.StatementMetadata in project neo4j by neo4j.

the class InTransactionState method processRunMessage.

private BoltStateMachineState processRunMessage(RunMessage message, StateMachineContext context) throws KernelException {
    long start = context.clock().millis();
    StatementProcessor statementProcessor = context.connectionState().getStatementProcessor();
    StatementMetadata statementMetadata = statementProcessor.run(message.statement(), message.params());
    long end = context.clock().millis();
    context.connectionState().onMetadata(FIELDS_KEY, stringArray(statementMetadata.fieldNames()));
    context.connectionState().onMetadata(FIRST_RECORD_AVAILABLE_KEY, Values.longValue(end - start));
    context.connectionState().onMetadata(QUERY_ID_KEY, Values.longValue(statementMetadata.queryId()));
    return this;
}
Also used : StatementProcessor(org.neo4j.bolt.runtime.statemachine.StatementProcessor) StatementMetadata(org.neo4j.bolt.runtime.statemachine.StatementMetadata)

Aggregations

StatementMetadata (org.neo4j.bolt.runtime.statemachine.StatementMetadata)5 StatementProcessor (org.neo4j.bolt.runtime.statemachine.StatementProcessor)3 CompletableFuture (java.util.concurrent.CompletableFuture)1