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

java.lang.Object
  extended by org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore
      extended by org.neo4j.kernel.impl.nioneo.store.AbstractStore
Direct Known Subclasses:
NeoStore, NodeStore, PropertyIndexStore, PropertyStore, RelationshipStore, RelationshipTypeStore

public abstract class AbstractStore
extends CommonAbstractStore

An abstract representation of a store. A store is a file that contains records. Each record has a fixed size (getRecordSize()) so the position for a record can be calculated by id * getRecordSize().

A store has an IdGenerator managing the records that are free or in use.


Field Summary
 
Fields inherited from class org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore
ALL_STORES_VERSION, logger, storageFileName, UNKNOWN_VERSION
 
Constructor Summary
AbstractStore(String fileName, Map<?,?> config, IdType idType)
           
 
Method Summary
protected static void createEmptyStore(String fileName, String typeAndVersionDescriptor, IdGeneratorFactory idGeneratorFactory)
          Creates a new empty store.
protected  long figureOutHighestIdInUse()
           
abstract  List<WindowPoolStats> getAllWindowPoolStats()
           
protected  int getEffectiveRecordSize()
           
abstract  int getRecordSize()
          Returns the fixed size of each record in this store.
protected  boolean isRecordInUse(ByteBuffer buffer)
           
protected  void readAndVerifyBlockSize()
           
protected  void rebuildIdGenerator()
          Rebuilds the IdGenerator by looping through all records and checking if record in use or not.
 void setHighId(int id)
          Sets the high id of IdGenerator.
protected  void verifyFileSizeAndTruncate()
           
 
Methods inherited from class org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore
acquireWindow, buildTypeDescriptorAndVersion, calculateMappedMemory, checkStorage, checkVersion, close, closeIdGenerator, closeStorage, createIdGenerator, flushAll, freeId, getConfig, getFileChannel, getFileSystem, getHighestPossibleIdInUse, getHighId, getIdType, getIfMemoryMapped, getNumberOfIdsInUse, getStorageFileName, getStoreDir, getStoreOk, getTypeAndVersionDescriptor, getTypeDescriptor, getWindowPoolStats, initStorage, isInRecoveryMode, loadStorage, logVersions, longFromIntAndMod, makeStoreOk, nextId, openIdGenerator, openIdGenerator, openReadOnlyIdGenerator, rebuildIdGenerators, registerIdFromUpdateRecord, releaseFileLockAndCloseFileChannel, releaseWindow, setHighId, setRecovered, setStoreNotOk, setWindowPool, toString, unsetRecovered, updateHighId, verifyCorrectTypeDescriptorAndVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractStore

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

getRecordSize

public abstract int getRecordSize()
Returns the fixed size of each record in this store.

Returns:
The record size

figureOutHighestIdInUse

protected long figureOutHighestIdInUse()
Specified by:
figureOutHighestIdInUse in class CommonAbstractStore

createEmptyStore

protected static void createEmptyStore(String fileName,
                                       String typeAndVersionDescriptor,
                                       IdGeneratorFactory idGeneratorFactory)
Creates a new empty store. The factory method returning an implementation of some store type should make use of this method to initialize an empty store.

This method will create a empty store containing the descriptor returned by the getTypeDescriptor(). The id generator used by this store will also be created

Parameters:
fileName - The file name of the store that will be created
typeAndVersionDescriptor - The type and version descriptor that identifies this store
Throws:
IOException - If fileName is null or if file exists

getEffectiveRecordSize

protected int getEffectiveRecordSize()
Specified by:
getEffectiveRecordSize in class CommonAbstractStore

readAndVerifyBlockSize

protected void readAndVerifyBlockSize()
                               throws IOException
Specified by:
readAndVerifyBlockSize in class CommonAbstractStore
Throws:
IOException

verifyFileSizeAndTruncate

protected void verifyFileSizeAndTruncate()
                                  throws IOException
Specified by:
verifyFileSizeAndTruncate in class CommonAbstractStore
Throws:
IOException

setHighId

public void setHighId(int id)
Sets the high id of IdGenerator.

Parameters:
id - The high id

isRecordInUse

protected boolean isRecordInUse(ByteBuffer buffer)

rebuildIdGenerator

protected void rebuildIdGenerator()
Rebuilds the IdGenerator by looping through all records and checking if record in use or not.

Specified by:
rebuildIdGenerator in class CommonAbstractStore
Throws:
IOException - if unable to rebuild the id generator

getAllWindowPoolStats

public abstract List<WindowPoolStats> getAllWindowPoolStats()


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