use of org.neo4j.storageengine.api.StorageReader in project neo4j by neo4j.
the class TransactionCountingStateVisitorTraceIT method traceStateWithChanges.
private void traceStateWithChanges(Consumer<Transaction> transactionalOperation) throws KernelException {
try (var transaction = database.beginTx()) {
var internalTransaction = (InternalTransaction) transaction;
KernelTransactionImplementation kernelTransaction = (KernelTransactionImplementation) internalTransaction.kernelTransaction();
var cursorContext = kernelTransaction.cursorContext();
transactionalOperation.accept(transaction);
cursorContext.getCursorTracer().reportEvents();
assertZeroCursor(cursorContext);
var transactionState = kernelTransaction.txState();
var counts = new CountsDelta();
try (StorageReader storageReader = kernelTransaction.newStorageReader();
var stateVisitor = new TransactionCountingStateVisitor(EMPTY, storageReader, transactionState, counts, cursorContext)) {
transactionState.accept(stateVisitor);
}
assertTwoCursor(cursorContext);
}
}
use of org.neo4j.storageengine.api.StorageReader in project neo4j by neo4j.
the class NeoStoresTest method reinitializeStores.
private void reinitializeStores(DatabaseLayout databaseLayout) {
Dependencies dependencies = new Dependencies();
Config config = Config.defaults(GraphDatabaseSettings.fail_on_missing_files, false);
dependencies.satisfyDependency(config);
closeStorageEngine();
IdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName());
TokenHolders tokenHolders = new TokenHolders(createReadOnlyTokenHolder(TokenHolder.TYPE_PROPERTY_KEY), createReadOnlyTokenHolder(TokenHolder.TYPE_LABEL), createReadOnlyTokenHolder(TokenHolder.TYPE_RELATIONSHIP_TYPE));
storageEngine = new RecordStorageEngine(databaseLayout, config, pageCache, fs, nullLogProvider(), tokenHolders, new DatabaseSchemaState(nullLogProvider()), new StandardConstraintRuleAccessor(), i -> i, NO_LOCK_SERVICE, mock(Health.class), idGeneratorFactory, new DefaultIdController(), immediate(), PageCacheTracer.NULL, true, INSTANCE, writable(), CommandLockVerification.Factory.IGNORE, LockVerificationMonitor.Factory.IGNORE);
life = new LifeSupport();
life.add(storageEngine);
life.add(storageEngine.schemaAndTokensLifecycle());
life.start();
NeoStores neoStores = storageEngine.testAccessNeoStores();
pStore = neoStores.getPropertyStore();
nodeStore = neoStores.getNodeStore();
storageReader = storageEngine.newReader();
}
Aggregations