use of org.neo4j.bolt.v3.runtime.ReadyState in project neo4j by neo4j.
the class ConnectedState method process.
@Override
public BoltStateMachineState process(RequestMessage message, StateMachineContext context) throws BoltConnectionFatality {
assertInitialized();
if (message instanceof HelloMessage) {
HelloMessage helloMessage = (HelloMessage) message;
String userAgent = helloMessage.userAgent();
Map<String, Object> authToken = helloMessage.authToken();
if (processAuthentication(userAgent, authToken, context, new RoutingContext(false, Collections.emptyMap()))) {
context.resolveDefaultDatabase();
context.connectionState().onMetadata(CONNECTION_ID_KEY, Values.utf8Value(context.connectionId()));
context.connectionState().onMetadata("hints", connectionHints);
return readyState;
} else {
return null;
}
}
return null;
}
use of org.neo4j.bolt.v3.runtime.ReadyState in project neo4j by neo4j.
the class BoltStateMachineV3 method buildStates.
@Override
protected States buildStates(MapValue connectionHints, MemoryTracker memoryTracker) {
memoryTracker.allocateHeap(ConnectedState.SHALLOW_SIZE + ReadyState.SHALLOW_SIZE + StreamingState.SHALLOW_SIZE + TransactionReadyState.SHALLOW_SIZE + TransactionStreamingState.SHALLOW_SIZE + FailedState.SHALLOW_SIZE + InterruptedState.SHALLOW_SIZE);
ConnectedState connected = new ConnectedState(connectionHints);
ReadyState ready = new ReadyState();
StreamingState streaming = new StreamingState();
TransactionReadyState txReady = new TransactionReadyState();
TransactionStreamingState txStreaming = new TransactionStreamingState();
FailedState failed = new FailedState();
InterruptedState interrupted = new InterruptedState();
connected.setReadyState(ready);
ready.setTransactionReadyState(txReady);
ready.setStreamingState(streaming);
ready.setFailedState(failed);
ready.setInterruptedState(interrupted);
streaming.setReadyState(ready);
streaming.setFailedState(failed);
streaming.setInterruptedState(interrupted);
txReady.setReadyState(ready);
txReady.setTransactionStreamingState(txStreaming);
txReady.setFailedState(failed);
txReady.setInterruptedState(interrupted);
txStreaming.setReadyState(txReady);
txStreaming.setFailedState(failed);
txStreaming.setInterruptedState(interrupted);
failed.setInterruptedState(interrupted);
interrupted.setReadyState(ready);
return new States(connected, failed);
}
use of org.neo4j.bolt.v3.runtime.ReadyState in project neo4j by neo4j.
the class BoltStateMachineV4 method buildStates.
@Override
protected States buildStates(MapValue connectionHints, MemoryTracker memoryTracker) {
memoryTracker.allocateHeap(ConnectedState.SHALLOW_SIZE + ReadyState.SHALLOW_SIZE + AutoCommitState.SHALLOW_SIZE + InTransactionState.SHALLOW_SIZE + FailedState.SHALLOW_SIZE + InterruptedState.SHALLOW_SIZE);
ConnectedState connected = new ConnectedState(connectionHints);
// v4
ReadyState ready = new ReadyState();
// v4
AutoCommitState autoCommitState = new AutoCommitState();
// v4
InTransactionState inTransaction = new InTransactionState();
// v4
FailedState failed = new FailedState();
InterruptedState interrupted = new InterruptedState();
connected.setReadyState(ready);
ready.setTransactionReadyState(inTransaction);
ready.setStreamingState(autoCommitState);
ready.setFailedState(failed);
ready.setInterruptedState(interrupted);
autoCommitState.setReadyState(ready);
autoCommitState.setFailedState(failed);
autoCommitState.setInterruptedState(interrupted);
inTransaction.setReadyState(ready);
inTransaction.setFailedState(failed);
inTransaction.setInterruptedState(interrupted);
failed.setInterruptedState(interrupted);
interrupted.setReadyState(ready);
return new States(connected, failed);
}
use of org.neo4j.bolt.v3.runtime.ReadyState in project neo4j by neo4j.
the class BoltStateMachineV43 method buildStates.
@Override
protected States buildStates(MapValue connectionHints, MemoryTracker memoryTracker) {
memoryTracker.allocateHeap(ConnectedState.SHALLOW_SIZE + RouteMessageHandleStateDecorator.SHALLOW_SIZE + ReadyState.SHALLOW_SIZE + AutoCommitState.SHALLOW_SIZE + InTransactionState.SHALLOW_SIZE + FailedState.SHALLOW_SIZE + InterruptedState.SHALLOW_SIZE);
// v4.1
var connected = new ConnectedState(connectionHints);
// v4
var autoCommitState = new AutoCommitState();
// v4
var inTransaction = new InTransactionState();
// v4
var failed = new FailedState();
// v4
var ready = RouteMessageHandleStateDecorator.decorate(new ReadyState(), failed);
// v3
var interrupted = new InterruptedState();
connected.setReadyState(ready);
ready.apply(it -> {
it.setTransactionReadyState(inTransaction);
it.setStreamingState(autoCommitState);
it.setFailedState(failed);
it.setInterruptedState(interrupted);
});
autoCommitState.setReadyState(ready);
autoCommitState.setFailedState(failed);
autoCommitState.setInterruptedState(interrupted);
inTransaction.setReadyState(ready);
inTransaction.setFailedState(failed);
inTransaction.setInterruptedState(interrupted);
failed.setInterruptedState(interrupted);
interrupted.setReadyState(ready);
return new States(connected, failed);
}
use of org.neo4j.bolt.v3.runtime.ReadyState in project neo4j by neo4j.
the class BoltStateMachineV41 method buildStates.
@Override
protected States buildStates(MapValue connectionHints, MemoryTracker memoryTracker) {
memoryTracker.allocateHeap(ConnectedState.SHALLOW_SIZE + ReadyState.SHALLOW_SIZE + AutoCommitState.SHALLOW_SIZE + InTransactionState.SHALLOW_SIZE + FailedState.SHALLOW_SIZE + InterruptedState.SHALLOW_SIZE);
// v4.1
ConnectedState connected = new ConnectedState(connectionHints);
// v4
ReadyState ready = new ReadyState();
// v4
AutoCommitState autoCommitState = new AutoCommitState();
// v4
InTransactionState inTransaction = new InTransactionState();
// v4
FailedState failed = new FailedState();
InterruptedState interrupted = new InterruptedState();
connected.setReadyState(ready);
ready.setTransactionReadyState(inTransaction);
ready.setStreamingState(autoCommitState);
ready.setFailedState(failed);
ready.setInterruptedState(interrupted);
autoCommitState.setReadyState(ready);
autoCommitState.setFailedState(failed);
autoCommitState.setInterruptedState(interrupted);
inTransaction.setReadyState(ready);
inTransaction.setFailedState(failed);
inTransaction.setInterruptedState(interrupted);
failed.setInterruptedState(interrupted);
interrupted.setReadyState(ready);
return new States(connected, failed);
}
Aggregations