org.neo4j.kernel.impl.persistence
Interface NeoStoreTransaction

All Known Implementing Classes:
InterceptingWriteTransaction, WriteTransaction

public interface NeoStoreTransaction

A connection to a PersistenceSource. ResourceConnection contains operations to retrieve the XAResource for this connection and to close the connection, optionally returning it to a connection pool.


Method Summary
 void createPropertyIndex(String key, int id)
          Creates a property index entry out of the given id and string.
 void createRelationshipType(int id, String name)
          Creates a new RelationshipType record with the given id that has the given name.
 void destroy()
          Destroy this transaction.
 RelIdArray getCreatedNodes()
          Returns an array view of the ids of the nodes that have been created in this transaction.
 int getKeyIdForProperty(PropertyData property)
          Returns the index key ids that are contained within the property record with the specified id.
 Pair<Map<RelIdArray.DirectionWrapper,Iterable<RelationshipRecord>>,Long> getMoreRelationships(long nodeId, long position)
           
 long getRelationshipChainPosition(long nodeId)
           
 XAResource getXAResource()
          Returns the XAResource that represents this connection.
 boolean isNodeCreated(long nodeId)
          Check if the node with the given id was created in this transaction.
 boolean isRelationshipCreated(long relId)
          Check if the node with the given id was created in this transaction.
 String loadIndex(int id)
          Loads the value object for the given property index record id if the record is light.
 PropertyIndexData[] loadPropertyIndexes(int maxCount)
          Tries to load as heavy records as many property index records as specified in the argument.
 Object loadPropertyValue(PropertyData property)
          Attempts to load the value off the store forthe given PropertyData object.
 RelationshipTypeData[] loadRelationshipTypes()
          Loads and returns all the available RelationshipTypes that are stored.
 PropertyData nodeAddProperty(long nodeId, PropertyIndex index, Object value)
          Adds a property to the given node, with the given index and value.
 PropertyData nodeChangeProperty(long nodeId, PropertyData index, Object value)
          Changes an existing property of the given node, with the given index to the passed value
 void nodeCreate(long id)
          Creates a node for the given id
 ArrayMap<Integer,PropertyData> nodeDelete(long nodeId)
          Deletes a node by its id, returning its properties which are now removed.
 boolean nodeLoadLight(long id)
          Tries to load the light node with the given id, returns true on success.
 ArrayMap<Integer,PropertyData> nodeLoadProperties(long nodeId, boolean light)
          Loads the complete property chain for the given node and returns it as a map from property index id to property data.
 void nodeRemoveProperty(long nodeId, PropertyData index)
          Removes the given property identified by indexKeyId of the node with the given id.
 PropertyData relAddProperty(long relId, PropertyIndex index, Object value)
          Adds a property to the given relationship, with the given index and value.
 void relationshipCreate(long id, int typeId, long startNodeId, long endNodeId)
          Creates a relationship with the given id, from the nodes identified by id and of type typeId
 PropertyData relChangeProperty(long relId, PropertyData index, Object value)
          Changes an existing property's value of the given relationship, with the given index to the passed value
 ArrayMap<Integer,PropertyData> relDelete(long relId)
          Deletes a relationship by its id, returning its properties which are now removed.
 RelationshipRecord relLoadLight(long id)
          Tries to load the light relationship with the given id, returns the record on success.
 ArrayMap<Integer,PropertyData> relLoadProperties(long relId, boolean light)
          Loads the complete property chain for the given relationship and returns it as a map from property index id to property data.
 void relRemoveProperty(long relId, PropertyData index)
          Removes the given property identified by its index from the relationship with the given id.
 void setXaConnection(XaConnection connection)
           
 

Method Detail

setXaConnection

void setXaConnection(XaConnection connection)

getXAResource

XAResource getXAResource()
Returns the XAResource that represents this connection.

Returns:
the XAResource for this connection

destroy

void destroy()
Destroy this transaction. Makes it not known to anyone.


nodeDelete

ArrayMap<Integer,PropertyData> nodeDelete(long nodeId)
Deletes a node by its id, returning its properties which are now removed.

Parameters:
nodeId - The id of the node to delete.
Returns:
The properties of the node that were removed during the delete.

nodeAddProperty

PropertyData nodeAddProperty(long nodeId,
                             PropertyIndex index,
                             Object value)
Adds a property to the given node, with the given index and value.

Parameters:
nodeId - The id of the node to which to add the property.
index - The index of the key of the property to add.
value - The value of the property.
Returns:
The added property, as a PropertyData object.

nodeChangeProperty

PropertyData nodeChangeProperty(long nodeId,
                                PropertyData index,
                                Object value)
Changes an existing property of the given node, with the given index to the passed value

Parameters:
nodeId - The id of the node which holds the property to change.
index - The index of the key of the property to change.
value - The new value of the property.
Returns:
The changed property, as a PropertyData object.

nodeRemoveProperty

void nodeRemoveProperty(long nodeId,
                        PropertyData index)
Removes the given property identified by indexKeyId of the node with the given id.

Parameters:
nodeId - The id of the node that is to have the property removed.
index - The index key of the property.

nodeCreate

void nodeCreate(long id)
Creates a node for the given id

Parameters:
id - The id of the node to create.

relationshipCreate

void relationshipCreate(long id,
                        int typeId,
                        long startNodeId,
                        long endNodeId)
Creates a relationship with the given id, from the nodes identified by id and of type typeId

Parameters:
id - The id of the relationship to create.
typeId - The id of the relationship type this relationship will have.
startNodeId - The id of the start node.
endNodeId - The id of the end node.

relDelete

ArrayMap<Integer,PropertyData> relDelete(long relId)
Deletes a relationship by its id, returning its properties which are now removed. It is assumed that the nodes it connects have already been deleted in this transaction.

Parameters:
relId - The id of the relationship to delete.
Returns:
The properties of the relationship that were removed during the delete.

relAddProperty

PropertyData relAddProperty(long relId,
                            PropertyIndex index,
                            Object value)
Adds a property to the given relationship, with the given index and value.

Parameters:
relId - The id of the relationship to which to add the property.
index - The index of the key of the property to add.
value - The value of the property.
Returns:
The added property, as a PropertyData object.

relChangeProperty

PropertyData relChangeProperty(long relId,
                               PropertyData index,
                               Object value)
Changes an existing property's value of the given relationship, with the given index to the passed value

Parameters:
relId - The id of the relationship which holds the property to change.
index - The index of the key of the property to change.
value - The new value of the property.
Returns:
The changed property, as a PropertyData object.

relRemoveProperty

void relRemoveProperty(long relId,
                       PropertyData index)
Removes the given property identified by its index from the relationship with the given id.

Parameters:
relId - The id of the relationship that is to have the property removed.
index - The index key of the property.

nodeLoadLight

boolean nodeLoadLight(long id)
Tries to load the light node with the given id, returns true on success.

Parameters:
id - The id of the node to load.
Returns:
True iff the node record can be found.

loadPropertyValue

Object loadPropertyValue(PropertyData property)
Attempts to load the value off the store forthe given PropertyData object.

Parameters:
property - The property to make heavy
Returns:
The property data

loadIndex

String loadIndex(int id)
Loads the value object for the given property index record id if the record is light.

Parameters:
id - The id of the property index record to make heavy
Returns:
The property index value

loadPropertyIndexes

PropertyIndexData[] loadPropertyIndexes(int maxCount)
Tries to load as heavy records as many property index records as specified in the argument.

Parameters:
maxCount - The maximum number of property index records to load.
Returns:
An array of the PropertyIndexData that were loaded - can be less than the number requested.

nodeLoadProperties

ArrayMap<Integer,PropertyData> nodeLoadProperties(long nodeId,
                                                  boolean light)
Loads the complete property chain for the given node and returns it as a map from property index id to property data.

Parameters:
nodeId - The id of the node whose properties to load.
light - If the properties should be loaded light or not.
Returns:
The properties loaded, as a map from property index id to property data.

relLoadProperties

ArrayMap<Integer,PropertyData> relLoadProperties(long relId,
                                                 boolean light)
Loads the complete property chain for the given relationship and returns it as a map from property index id to property data.

Parameters:
relId - The id of the relationship whose properties to load.
light - If the properties should be loaded light or not.
Returns:
The properties loaded, as a map from property index id to property data.

relLoadLight

RelationshipRecord relLoadLight(long id)
Tries to load the light relationship with the given id, returns the record on success.

Parameters:
id - The id of the relationship to load.
Returns:
The light RelationshipRecord if it was found, null otherwise.

loadRelationshipTypes

RelationshipTypeData[] loadRelationshipTypes()
Loads and returns all the available RelationshipTypes that are stored.

Returns:
All the stored RelationshipTypes, as a RelationshipTypeData array

createPropertyIndex

void createPropertyIndex(String key,
                         int id)
Creates a property index entry out of the given id and string.

Parameters:
key - The key of the property index, as a string.
id - The property index record id.

createRelationshipType

void createRelationshipType(int id,
                            String name)
Creates a new RelationshipType record with the given id that has the given name.

Parameters:
id - The id of the new relationship type record.
name - The name of the relationship type.

getRelationshipChainPosition

long getRelationshipChainPosition(long nodeId)

getMoreRelationships

Pair<Map<RelIdArray.DirectionWrapper,Iterable<RelationshipRecord>>,Long> getMoreRelationships(long nodeId,
                                                                                              long position)

getCreatedNodes

RelIdArray getCreatedNodes()
Returns an array view of the ids of the nodes that have been created in this transaction.

Returns:
An array of the ids of the nodes created in this transaction.

isNodeCreated

boolean isNodeCreated(long nodeId)
Check if the node with the given id was created in this transaction.

Parameters:
nodeId - The node id to check.
Returns:
True iff a node with the given id was created in this transaction.

isRelationshipCreated

boolean isRelationshipCreated(long relId)
Check if the node with the given id was created in this transaction.

Parameters:
nodeId - The node id to check.
Returns:
True iff a node with the given id was created in this transaction.

getKeyIdForProperty

int getKeyIdForProperty(PropertyData property)
Returns the index key ids that are contained within the property record with the specified id.

Parameters:
property - The PropertyData of the property record.
Returns:
an array that contains all the property index ids of the blocks in the record.


Copyright © 2002-2012 The Neo4j Graph Database Project. All Rights Reserved.