public interface StorageStatement extends AutoCloseable
StoreReadLayer. Most data about the entities of a graph
are accessed through this statement interface as opposed to through the StoreReadLayer directly.
One of the main reasons is that the access methods returns objects, like cursors which
are valuable to reuse over a reasonably large window to reduce garbage churn in general.
A StorageStatement must be acquired before use. After use the statement
should be released. After released the statement can be acquired again.
Creating and closing StorageStatement and there's also benefits keeping these statements opened
during a longer period of time, with the assumption that it's still one thread at a time using each.
With that in mind these statements should not be opened and closed for each operation, perhaps not even
for each transaction.
All cursors provided by this statement are views over data in the store. They do not interact with transaction state.
| Modifier and Type | Method and Description |
|---|---|
void |
acquire()
Acquires this statement so that it can be used, should later be
released. |
org.neo4j.cursor.Cursor<NodeItem> |
acquireSingleNodeCursor(long nodeId)
|
org.neo4j.cursor.Cursor<RelationshipItem> |
acquireSingleRelationshipCursor(long relationshipId)
|
void |
close()
Closes this statement so that it can no longer be used nor
acquired. |
IndexReader |
getFreshIndexReader(org.neo4j.kernel.api.schema.IndexDescriptor index)
Returns an
IndexReader for searching entity ids given property values. |
IndexReader |
getIndexReader(org.neo4j.kernel.api.schema.IndexDescriptor index)
Returns an
IndexReader for searching entity ids given property values. |
LabelScanReader |
getLabelScanReader() |
org.neo4j.cursor.Cursor<RelationshipItem> |
relationshipsGetAllCursor()
|
void |
release()
Releases this statement so that it can later be
acquired again. |
void acquire()
released.
Since a StorageStatement can be reused after released, this call should
do initialization/clearing of state whereas data structures can be kept between uses.void release()
acquired again.void close()
acquired.close in interface AutoCloseableorg.neo4j.cursor.Cursor<NodeItem> acquireSingleNodeCursor(long nodeId)
Cursor capable of serving NodeItem for selected nodes.
No node is selected when this method returns, a call to Cursor.next() will have to be made
to place the cursor over the first item and then more calls to move the cursor through the selection.nodeId - id of node to get cursor for.Cursor over NodeItem for the given nodeId.org.neo4j.cursor.Cursor<RelationshipItem> acquireSingleRelationshipCursor(long relationshipId)
Cursor capable of serving RelationshipItem for selected
relationships. No relationship is selected when this method returns, a call to Cursor.next()
will have to be made to place the cursor over the first item and then more calls to move the cursor
through the selection.relationshipId - id of relationship to get cursor for.Cursor over RelationshipItem for the given relationshipId.org.neo4j.cursor.Cursor<RelationshipItem> relationshipsGetAllCursor()
Cursor capable of serving RelationshipItem for selected
- * relationships. No relationship is selected when this method returns, a call to Cursor.next()
- * will have to be made to place the cursor over the first item and then more calls to move the cursor
- * through the selection.
- *
- * @return a Cursor over all stored relationships.
-LabelScanReader getLabelScanReader()
LabelScanReader capable of reading nodes for specific label ids.IndexReader getIndexReader(org.neo4j.kernel.api.schema.IndexDescriptor index) throws org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException
IndexReader for searching entity ids given property values. One reader is allocated
and kept per index throughout the life of a statement, making the returned reader repeatable-read isolation.
NOTE:
Reader returned from this method should not be closed. All such readers will be closed during close()
of the current statement.
index - IndexDescriptor to get reader for.IndexReader capable of searching entity ids given property values.org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException - if no such index exists.IndexReader getFreshIndexReader(org.neo4j.kernel.api.schema.IndexDescriptor index) throws org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException
IndexReader for searching entity ids given property values. A new reader is allocated
every call to this method, which means that newly committed data since the last call to this method
will be visible in the returned reader.
NOTE: It is caller's responsibility to close the returned reader.
index - IndexDescriptor to get reader for.IndexReader capable of searching entity ids given property values.org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException - if no such index exists.Copyright © 2002–2017 The Neo4j Graph Database Project. All rights reserved.