org.neo4j.kernel.impl.nioneo.store
Class RelationshipTypeStore

java.lang.Object
  extended by org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore
      extended by org.neo4j.kernel.impl.nioneo.store.AbstractStore
          extended by org.neo4j.kernel.impl.nioneo.store.RelationshipTypeStore
All Implemented Interfaces:
RecordStore<RelationshipTypeRecord>, Store

public class RelationshipTypeStore
extends AbstractStore
implements Store, RecordStore<RelationshipTypeRecord>

Implementation of the relationship type store. Uses a dynamic store to store relationship type names.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.neo4j.kernel.impl.nioneo.store.RecordStore
RecordStore.Processor
 
Field Summary
static String TYPE_DESCRIPTOR
           
 
Fields inherited from class org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore
ALL_STORES_VERSION, logger, storageFileName, UNKNOWN_VERSION
 
Fields inherited from interface org.neo4j.kernel.impl.nioneo.store.RecordStore
IN_USE
 
Constructor Summary
RelationshipTypeStore(String fileName, Map<?,?> config, IdType idType)
           
 
Method Summary
 void accept(RecordStore.Processor processor, RelationshipTypeRecord record)
           
 Collection<DynamicRecord> allocateTypeNameRecords(int startBlock, byte[] src)
           
protected  void closeStorage()
          This method should close/release all resources that the implementation of this store has allocated and is called just before the close() method returns.
static void createStore(String fileName, Map<?,?> config)
          Creates a new relationship type store contained in fileName If filename is null or the file already exists an IOException is thrown.
 void flushAll()
           
 RelationshipTypeRecord forceGetRaw(long id)
           
 RelationshipTypeRecord forceGetRecord(long id)
           
 void forceUpdateRecord(RelationshipTypeRecord record)
           
 void freeBlockId(int id)
           
 List<WindowPoolStats> getAllWindowPoolStats()
           
 RelationshipTypeRecord getRecord(int id)
           
 RelationshipTypeRecord getRecord(long id)
           
 int getRecordHeaderSize()
           
 int getRecordSize()
          Returns the fixed size of each record in this store.
 RelationshipTypeData getRelationshipType(int id)
           
 RelationshipTypeData getRelationshipType(int id, boolean recovered)
           
 RelationshipTypeData[] getRelationshipTypes()
           
 String getStringFor(RelationshipTypeRecord relTypeRecord)
           
 String getTypeDescriptor()
          Returns the type and version that identifies this store.
protected  void initStorage()
          Called from the constructor after the end header has been checked.
 void logIdUsage(StringLogger logger)
           
 void makeStoreOk()
          If store is not ok a call to this method will rebuild the IdGenerator used by this store and if successful mark it as ok.
 long nextBlockId()
           
protected  void rebuildIdGenerator()
          Rebuilds the IdGenerator by looping through all records and checking if record in use or not.
 void rebuildIdGenerators()
           
protected  void setRecovered()
           
protected  void unsetRecovered()
           
 void updateIdGenerators()
           
 void updateRecord(RelationshipTypeRecord record)
           
 void updateRecord(RelationshipTypeRecord record, boolean recovered)
           
 
Methods inherited from class org.neo4j.kernel.impl.nioneo.store.AbstractStore
createEmptyStore, figureOutHighestIdInUse, getEffectiveRecordSize, isRecordInUse, readAndVerifyBlockSize, setHighId, verifyFileSizeAndTruncate
 
Methods inherited from class org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore
acquireWindow, buildTypeDescriptorAndVersion, calculateMappedMemory, checkStorage, checkVersion, close, closeIdGenerator, createIdGenerator, freeId, getConfig, getFileChannel, getFileSystem, getHighestPossibleIdInUse, getHighId, getIdType, getIfMemoryMapped, getNumberOfIdsInUse, getStorageFileName, getStoreDir, getStoreOk, getTypeAndVersionDescriptor, getWindowPoolStats, isInRecoveryMode, loadStorage, logVersions, longFromIntAndMod, nextId, openIdGenerator, openIdGenerator, openReadOnlyIdGenerator, registerIdFromUpdateRecord, releaseFileLockAndCloseFileChannel, releaseWindow, setHighId, setStoreNotOk, setWindowPool, toString, updateHighId, verifyCorrectTypeDescriptorAndVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.neo4j.kernel.impl.nioneo.store.Store
getHighestPossibleIdInUse, getNumberOfIdsInUse, getWindowPoolStats, nextId
 
Methods inherited from interface org.neo4j.kernel.impl.nioneo.store.RecordStore
close, getHighId
 

Field Detail

TYPE_DESCRIPTOR

public static final String TYPE_DESCRIPTOR
See Also:
Constant Field Values
Constructor Detail

RelationshipTypeStore

public RelationshipTypeStore(String fileName,
                             Map<?,?> config,
                             IdType idType)
Method Detail

accept

public void accept(RecordStore.Processor processor,
                   RelationshipTypeRecord record)
Specified by:
accept in interface RecordStore<RelationshipTypeRecord>

setRecovered

protected void setRecovered()
Overrides:
setRecovered in class CommonAbstractStore

unsetRecovered

protected void unsetRecovered()
Overrides:
unsetRecovered in class CommonAbstractStore

initStorage

protected void initStorage()
Description copied from class: CommonAbstractStore
Called from the constructor after the end header has been checked. The store implementation can setup it's persistence windows and other resources that are needed by overriding this implementation.

This default implementation does nothing.

Overrides:
initStorage in class CommonAbstractStore

closeStorage

protected void closeStorage()
Description copied from class: CommonAbstractStore
This method should close/release all resources that the implementation of this store has allocated and is called just before the close() method returns. Override this method to clean up stuff created in CommonAbstractStore.initStorage() method.

This default implementation does nothing.

Overrides:
closeStorage in class CommonAbstractStore

flushAll

public void flushAll()
Overrides:
flushAll in class CommonAbstractStore

getTypeDescriptor

public String getTypeDescriptor()
Description copied from class: CommonAbstractStore
Returns the type and version that identifies this store.

Specified by:
getTypeDescriptor in interface Store
Specified by:
getTypeDescriptor in class CommonAbstractStore
Returns:
This store's implementation type and version identifier

getRecordSize

public int getRecordSize()
Description copied from class: AbstractStore
Returns the fixed size of each record in this store.

Specified by:
getRecordSize in interface RecordStore<RelationshipTypeRecord>
Specified by:
getRecordSize in class AbstractStore
Returns:
The record size

getRecordHeaderSize

public int getRecordHeaderSize()
Specified by:
getRecordHeaderSize in interface RecordStore<RelationshipTypeRecord>

createStore

public static void createStore(String fileName,
                               Map<?,?> config)
Creates a new relationship type store contained in fileName If filename is null or the file already exists an IOException is thrown.

Parameters:
fileName - File name of the new relationship type store
Throws:
IOException - If unable to create store or name null

allocateTypeNameRecords

public Collection<DynamicRecord> allocateTypeNameRecords(int startBlock,
                                                         byte[] src)

updateRecord

public void updateRecord(RelationshipTypeRecord record,
                         boolean recovered)

updateRecord

public void updateRecord(RelationshipTypeRecord record)
Specified by:
updateRecord in interface RecordStore<RelationshipTypeRecord>

forceUpdateRecord

public void forceUpdateRecord(RelationshipTypeRecord record)
Specified by:
forceUpdateRecord in interface RecordStore<RelationshipTypeRecord>

getRecord

public RelationshipTypeRecord getRecord(int id)

getRecord

public RelationshipTypeRecord getRecord(long id)
Specified by:
getRecord in interface RecordStore<RelationshipTypeRecord>

forceGetRecord

public RelationshipTypeRecord forceGetRecord(long id)
Specified by:
forceGetRecord in interface RecordStore<RelationshipTypeRecord>

forceGetRaw

public RelationshipTypeRecord forceGetRaw(long id)
Specified by:
forceGetRaw in interface RecordStore<RelationshipTypeRecord>

getRelationshipType

public RelationshipTypeData getRelationshipType(int id,
                                                boolean recovered)

getRelationshipType

public RelationshipTypeData getRelationshipType(int id)

getRelationshipTypes

public RelationshipTypeData[] getRelationshipTypes()

nextBlockId

public long nextBlockId()

freeBlockId

public void freeBlockId(int id)

rebuildIdGenerator

protected void rebuildIdGenerator()
Description copied from class: AbstractStore
Rebuilds the IdGenerator by looping through all records and checking if record in use or not.

Overrides:
rebuildIdGenerator in class AbstractStore

getStringFor

public String getStringFor(RelationshipTypeRecord relTypeRecord)

makeStoreOk

public void makeStoreOk()
Description copied from class: CommonAbstractStore
If store is not ok a call to this method will rebuild the IdGenerator used by this store and if successful mark it as ok.

Overrides:
makeStoreOk in class CommonAbstractStore

rebuildIdGenerators

public void rebuildIdGenerators()
Overrides:
rebuildIdGenerators in class CommonAbstractStore

updateIdGenerators

public void updateIdGenerators()

getAllWindowPoolStats

public List<WindowPoolStats> getAllWindowPoolStats()
Specified by:
getAllWindowPoolStats in class AbstractStore

logIdUsage

public void logIdUsage(StringLogger logger)
Specified by:
logIdUsage in interface Store


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