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

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.PropertyStore
All Implemented Interfaces:
RecordStore<PropertyRecord>, Store

public class PropertyStore
extends AbstractStore
implements Store, RecordStore<PropertyRecord>

Implementation of the property store. This implementation has two dynamic stores. One used to store keys and another for string property values.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.neo4j.kernel.impl.nioneo.store.RecordStore
RecordStore.Processor
 
Field Summary
static int DEFAULT_DATA_BLOCK_SIZE
           
static int DEFAULT_PAYLOAD_SIZE
           
static int RECORD_SIZE
           
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
PropertyStore(String fileName, Map<?,?> config)
           
 
Method Summary
 void accept(RecordStore.Processor processor, PropertyRecord record)
           
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 property store contained in fileName If filename is null or the file already exists an IOException is thrown.
static byte[] encodeString(String string)
           
 void encodeValue(PropertyBlock block, int keyId, Object value)
           
 void flushAll()
           
 PropertyRecord forceGetRaw(long id)
           
 PropertyRecord forceGetRecord(long id)
           
 void forceUpdateRecord(PropertyRecord record)
           
 void freeArrayBlockId(long blockId)
           
 void freeStringBlockId(long blockId)
           
 List<WindowPoolStats> getAllWindowPoolStats()
           
 int getArrayBlockSize()
           
static Object getArrayFor(long startRecord, Iterable<DynamicRecord> records, DynamicArrayStore arrayPropertyStore)
           
 Object getArrayFor(PropertyBlock propertyBlock)
           
 PropertyIndexStore getIndexStore()
           
 PropertyRecord getLightRecord(long id)
           
 PropertyRecord getRecord(long id)
           
 int getRecordHeaderSize()
           
 int getRecordSize()
          Returns the fixed size of each record in this store.
 int getStringBlockSize()
           
static Object getStringFor(AbstractDynamicStore store, long startRecord, Collection<DynamicRecord> dynamicRecords)
           
static Object getStringFor(AbstractDynamicStore store, PropertyBlock propertyBlock)
           
static Object getStringFor(byte[] byteArray)
           
 Object getStringFor(PropertyBlock propertyBlock)
           
 String getTypeDescriptor()
          Returns the type and version that identifies this store.
 Object getValue(PropertyBlock propertyBlock)
           
protected  void initStorage()
          Called from the constructor after the end header has been checked.
protected  boolean isRecordInUse(ByteBuffer buffer)
           
 void logIdUsage(StringLogger logger)
           
 void logVersions(StringLogger msgLog)
           
 void makeHeavy(PropertyBlock record)
           
 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.
static Pair<byte[],byte[]> readFullByteArray(long startRecord, Iterable<DynamicRecord> records, AbstractDynamicStore store, PropertyType propertyType)
           
 void rebuildIdGenerators()
           
protected  void setRecovered()
           
 String toString()
           
protected  void unsetRecovered()
           
 void updateIdGenerators()
           
 void updateRecord(PropertyRecord record)
           
 void updateRecord(PropertyRecord record, boolean recovered)
           
 
Methods inherited from class org.neo4j.kernel.impl.nioneo.store.AbstractStore
createEmptyStore, figureOutHighestIdInUse, getEffectiveRecordSize, readAndVerifyBlockSize, rebuildIdGenerator, 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, longFromIntAndMod, nextId, openIdGenerator, openIdGenerator, openReadOnlyIdGenerator, registerIdFromUpdateRecord, releaseFileLockAndCloseFileChannel, releaseWindow, setHighId, setStoreNotOk, setWindowPool, 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

DEFAULT_DATA_BLOCK_SIZE

public static final int DEFAULT_DATA_BLOCK_SIZE
See Also:
Constant Field Values

DEFAULT_PAYLOAD_SIZE

public static final int DEFAULT_PAYLOAD_SIZE
See Also:
Constant Field Values

TYPE_DESCRIPTOR

public static final String TYPE_DESCRIPTOR
See Also:
Constant Field Values

RECORD_SIZE

public static final int RECORD_SIZE
See Also:
Constant Field Values
Constructor Detail

PropertyStore

public PropertyStore(String fileName,
                     Map<?,?> config)
Method Detail

accept

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

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

setRecovered

protected void setRecovered()
Overrides:
setRecovered in class CommonAbstractStore

unsetRecovered

protected void unsetRecovered()
Overrides:
unsetRecovered 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<PropertyRecord>
Specified by:
getRecordSize in class AbstractStore
Returns:
The record size

getRecordHeaderSize

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

createStore

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

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

freeStringBlockId

public void freeStringBlockId(long blockId)

freeArrayBlockId

public void freeArrayBlockId(long blockId)

getIndexStore

public PropertyIndexStore getIndexStore()

updateRecord

public void updateRecord(PropertyRecord record,
                         boolean recovered)

updateRecord

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

forceUpdateRecord

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

getLightRecord

public PropertyRecord getLightRecord(long id)

makeHeavy

public void makeHeavy(PropertyBlock record)

getRecord

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

forceGetRecord

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

forceGetRaw

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

getValue

public Object getValue(PropertyBlock propertyBlock)

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()

encodeValue

public void encodeValue(PropertyBlock block,
                        int keyId,
                        Object value)

encodeString

public static byte[] encodeString(String string)

getStringFor

public Object getStringFor(PropertyBlock propertyBlock)

getStringFor

public static Object getStringFor(AbstractDynamicStore store,
                                  PropertyBlock propertyBlock)

getStringFor

public static Object getStringFor(AbstractDynamicStore store,
                                  long startRecord,
                                  Collection<DynamicRecord> dynamicRecords)

getStringFor

public static Object getStringFor(byte[] byteArray)

getArrayFor

public Object getArrayFor(PropertyBlock propertyBlock)

getArrayFor

public static Object getArrayFor(long startRecord,
                                 Iterable<DynamicRecord> records,
                                 DynamicArrayStore arrayPropertyStore)

readFullByteArray

public static Pair<byte[],byte[]> readFullByteArray(long startRecord,
                                                    Iterable<DynamicRecord> records,
                                                    AbstractDynamicStore store,
                                                    PropertyType propertyType)

getAllWindowPoolStats

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

getStringBlockSize

public int getStringBlockSize()

getArrayBlockSize

public int getArrayBlockSize()

isRecordInUse

protected boolean isRecordInUse(ByteBuffer buffer)
Overrides:
isRecordInUse in class AbstractStore

logVersions

public void logVersions(StringLogger msgLog)
Overrides:
logVersions in class CommonAbstractStore

logIdUsage

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

toString

public String toString()
Overrides:
toString in class CommonAbstractStore


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