use of org.neo4j.kernel.impl.core.NodeProxy in project neo4j by neo4j.
the class GraphDatabaseFacade method init.
/**
* Create a new Core API facade, backed by the given SPI and using pre-resolved dependencies
*/
public void init(SPI spi, Guard guard, ThreadToStatementContextBridge txBridge, Config config) {
this.spi = spi;
this.defaultTransactionTimeout = config.get(GraphDatabaseSettings.transaction_timeout);
Supplier<Statement> statementSupplier = spi::currentStatement;
Supplier<KernelTransaction> transactionSupplier = spi::currentTransaction;
ThrowingAction<RuntimeException> assertTransactionOpen = this::assertTransactionOpen;
this.schema = new SchemaImpl(statementSupplier);
this.relActions = new StandardRelationshipActions(statementSupplier, transactionSupplier, assertTransactionOpen, (id) -> new NodeProxy(nodeActions, id), this);
this.nodeActions = new StandardNodeActions(statementSupplier, transactionSupplier, assertTransactionOpen, relActions, this);
this.indexManager = Suppliers.lazySingleton(() -> {
IndexProviderImpl idxProvider = new IndexProviderImpl(this, statementSupplier);
AutoIndexerFacade<Node> nodeAutoIndexer = new AutoIndexerFacade<>(() -> new ReadOnlyIndexFacade<>(idxProvider.getOrCreateNodeIndex(NODE_AUTO_INDEX, null)), spi.autoIndexing().nodes());
RelationshipAutoIndexerFacade relAutoIndexer = new RelationshipAutoIndexerFacade(() -> new ReadOnlyRelationshipIndexFacade(idxProvider.getOrCreateRelationshipIndex(RELATIONSHIP_AUTO_INDEX, null)), spi.autoIndexing().relationships());
return new IndexManagerImpl(statementSupplier, idxProvider, nodeAutoIndexer, relAutoIndexer);
});
this.contextFactory = Neo4jTransactionalContextFactory.create(spi, guard, txBridge, locker);
}
use of org.neo4j.kernel.impl.core.NodeProxy in project neo4j by neo4j.
the class GraphDatabaseFacade method allNodesWithLabel.
private ResourceIterator<Node> allNodesWithLabel(final Label myLabel) {
Statement statement = spi.currentStatement();
int labelId = statement.readOperations().labelGetForName(myLabel.name());
if (labelId == KeyReadOperations.NO_SUCH_LABEL) {
statement.close();
return emptyIterator();
}
final PrimitiveLongIterator nodeIds = statement.readOperations().nodesGetForLabel(labelId);
return ResourceClosingIterator.newResourceIterator(statement, map(nodeId -> new NodeProxy(nodeActions, nodeId), nodeIds));
}
Aggregations