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<RelationshipItem> |
acquireNodeRelationshipCursor(boolean isDense,
long nodeId,
long relationshipId,
Direction direction,
IntPredicate relTypeFilter)
|
org.neo4j.cursor.Cursor<PropertyItem> |
acquirePropertyCursor(long propertyId,
org.neo4j.kernel.impl.locking.Lock shortLivedReadLock,
org.neo4j.kernel.api.AssertOpen assertOpen) |
org.neo4j.cursor.Cursor<NodeItem> |
acquireSingleNodeCursor(long nodeId)
|
org.neo4j.cursor.Cursor<PropertyItem> |
acquireSinglePropertyCursor(long propertyId,
int propertyKeyId,
org.neo4j.kernel.impl.locking.Lock shortLivedReadLock,
org.neo4j.kernel.api.AssertOpen assertOpen) |
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.index.IndexDescriptor index)
Returns an
IndexReader for searching entity ids given property values. |
IndexReader |
getIndexReader(org.neo4j.kernel.api.schema.index.IndexDescriptor index)
Returns an
IndexReader for searching entity ids given property values. |
LabelScanReader |
getLabelScanReader() |
org.neo4j.kernel.impl.store.RecordCursors |
recordCursors()
Access to low level record cursors
|
org.neo4j.cursor.Cursor<RelationshipItem> |
relationshipsGetAllCursor()
|
void |
release()
Releases this statement so that it can later be
acquired again. |
long |
reserveNode()
Reserves a node id for future use to store a node.
|
long |
reserveRelationship()
Reserves a relationship id for future use to store a relationship.
|
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 AutoCloseable
org.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> acquireNodeRelationshipCursor(boolean isDense, long nodeId, long relationshipId, Direction direction, IntPredicate relTypeFilter)
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.isDense
- if the node is densenodeId
- the id of the node where to start traversing the relationshipsrelationshipId
- the id of the first relationship in the chaindirection
- the direction of the relationship wrt the noderelTypeFilter
- the allowed types (it allows all types if unspecified)Cursor
over RelationshipItem
for traversing the relationships associated to the node.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.
-org.neo4j.cursor.Cursor<PropertyItem> acquirePropertyCursor(long propertyId, org.neo4j.kernel.impl.locking.Lock shortLivedReadLock, org.neo4j.kernel.api.AssertOpen assertOpen)
org.neo4j.cursor.Cursor<PropertyItem> acquireSinglePropertyCursor(long propertyId, int propertyKeyId, org.neo4j.kernel.impl.locking.Lock shortLivedReadLock, org.neo4j.kernel.api.AssertOpen assertOpen)
LabelScanReader getLabelScanReader()
LabelScanReader
capable of reading nodes for specific label ids.IndexReader getIndexReader(org.neo4j.kernel.api.schema.index.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.index.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.org.neo4j.kernel.impl.store.RecordCursors recordCursors()
long reserveNode()
long reserveRelationship()
Copyright © 2002–2018 The Neo4j Graph Database Project. All rights reserved.