|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkrati.store.DynamicDataStore
public class DynamicDataStore
DynamicDataStore is implemented using Linear Hashing. Its capacity grows as needed. The key-value pairs are stored in the underlying DataArray using the following format:
[count:int][key-length:int][key:bytes][value-length:int][value:bytes][key-length:int][key:bytes][value-length:int][value:bytes]... +------------------ key-value pair 1 ---------------------+------------------- key-value pair 2 -------------------+
Constructor Summary | |
---|---|
DynamicDataStore(File homeDir,
int initLevel,
int entrySize,
int maxEntries,
int segmentFileSizeMB,
SegmentFactory segmentFactory)
Creates a dynamic DataStore with the settings below: |
|
DynamicDataStore(File homeDir,
int initLevel,
int entrySize,
int maxEntries,
int segmentFileSizeMB,
SegmentFactory segmentFactory,
double segmentCompactFactor,
double hashLoadThreshold,
HashFunction<byte[]> hashFunction)
Creates a dynamic DataStore. |
|
DynamicDataStore(File homeDir,
int initLevel,
int entrySize,
int maxEntries,
int segmentFileSizeMB,
SegmentFactory segmentFactory,
double hashLoadThreshold,
HashFunction<byte[]> hashFunction)
Creates a dynamic DataStore. |
|
DynamicDataStore(File homeDir,
int initLevel,
int segmentFileSizeMB,
SegmentFactory segmentFactory)
Creates a dynamic DataStore with the settings below: |
|
DynamicDataStore(File homeDir,
int initLevel,
int segmentFileSizeMB,
SegmentFactory segmentFactory,
double hashLoadThreshold,
HashFunction<byte[]> hashFunction)
Creates a dynamic DataStore with the settings below: |
|
DynamicDataStore(File homeDir,
int initLevel,
SegmentFactory segmentFactory)
Creates a dynamic DataStore with the settings below: |
|
DynamicDataStore(File homeDir,
int initLevel,
SegmentFactory segmentFactory,
HashFunction<byte[]> hashFunction)
Creates a dynamic DataStore with the settings below: |
|
DynamicDataStore(File homeDir,
SegmentFactory segmentFactory)
Creates a dynamic DataStore with the settings below: |
Method Summary | |
---|---|
void |
clear()
|
protected DynamicLongArray |
createAddressArray(int entrySize,
int maxEntries,
File homeDirectory)
|
boolean |
delete(byte[] key)
|
protected boolean |
deleteInternal(int index,
byte[] key)
|
byte[] |
get(byte[] key)
|
int |
getCapacity()
|
DataArray |
getDataArray()
|
protected int |
getIndex(byte[] key)
|
protected int |
getIndex(long hashCode)
|
int |
getLevel()
|
int |
getLevelCapacity()
|
int |
getLoadCount()
|
double |
getLoadFactor()
|
double |
getLoadThreshold()
|
int |
getSplit()
|
String |
getStatus()
|
int |
getUnitCapacity()
|
protected long |
hash(byte[] key)
|
Iterator<Map.Entry<byte[],byte[]>> |
iterator()
|
Iterator<byte[]> |
keyIterator()
|
protected long |
nextScn()
|
void |
persist()
|
boolean |
put(byte[] key,
byte[] value)
|
protected boolean |
putInternal(int index,
byte[] key,
byte[] value)
|
void |
rehash()
|
protected void |
split()
|
void |
sync()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DynamicDataStore(File homeDir, SegmentFactory segmentFactory) throws Exception
Initial Level : 0 Entry Size : 10000 Max Entries : 5 Segment File Size : 256MB Segment Compact Factor : 0.5 Store Hash Load Factor : 0.75 Store Hash Function : krati.util.FnvHashFunction
homeDir
- the home directory of DataStoresegmentFileSizeMB
- the size of segment file in MBsegmentFactory
- the segment factory
Exception
- if this dynamic data store cannot be created.public DynamicDataStore(File homeDir, int initLevel, SegmentFactory segmentFactory) throws Exception
Entry Size : 10000 Max Entries : 5 Segment File Size : 256MB Segment Compact Factor : 0.5 Store Hash Load Factor : 0.75 Store Hash Function : krati.util.FnvHashFunction
homeDir
- the home directory of DataStoreinitLevel
- the initial level when DataStore is createdsegmentFactory
- the segment factory
Exception
- if this dynamic data store cannot be created.public DynamicDataStore(File homeDir, int initLevel, SegmentFactory segmentFactory, HashFunction<byte[]> hashFunction) throws Exception
Entry Size : 10000 Max Entries : 5 Segment File Size : 256MB Segment Compact Factor : 0.5 Store Hash Load Factor : 0.75
homeDir
- the home directory of DataStoreinitLevel
- the initial level when DataStore is createdsegmentFactory
- the segment factoryhashFunction
- the hash function for mapping keys to indexes
Exception
- if this dynamic data store cannot be created.public DynamicDataStore(File homeDir, int initLevel, int segmentFileSizeMB, SegmentFactory segmentFactory) throws Exception
Entry Size : 10000 Max Entries : 5 Segment Compact Factor : 0.5 Store Hash Load Factor : 0.75 Store Hash Function : krati.util.FnvHashFunction
homeDir
- the home directory of DataStoreinitLevel
- the initial level when DataStore is createdsegmentFileSizeMB
- the size of segment file in MBsegmentFactory
- the segment factory
Exception
- if this dynamic data store cannot be created.public DynamicDataStore(File homeDir, int initLevel, int segmentFileSizeMB, SegmentFactory segmentFactory, double hashLoadThreshold, HashFunction<byte[]> hashFunction) throws Exception
Entry Size : 10000 Max Entries : 5 Segment Compact Factor : 0.5
homeDir
- the home directory of DataStoreinitLevel
- the initial level when DataStore is createdsegmentFileSizeMB
- the size of segment file in MBsegmentFactory
- the segment factoryhashLoadThreshold
- the load factor of the underlying address array (hash table)hashFunction
- the hash function for mapping keys to indexes
Exception
- if this dynamic data store cannot be created.public DynamicDataStore(File homeDir, int initLevel, int entrySize, int maxEntries, int segmentFileSizeMB, SegmentFactory segmentFactory) throws Exception
Segment Compact Factor : 0.5 Store Hash Load Factor : 0.75 Store Hash Function : krati.util.FnvHashFunction
homeDir
- the home directory of DataStoreinitLevel
- the initial level when DataStore is createdentrySize
- the redo entry size (i.e., batch size)maxEntries
- the number of redo entries required for updating the underlying address arraysegmentFileSizeMB
- the size of segment file in MBsegmentFactory
- the segment factory
Exception
- if this dynamic data store cannot be created.public DynamicDataStore(File homeDir, int initLevel, int entrySize, int maxEntries, int segmentFileSizeMB, SegmentFactory segmentFactory, double hashLoadThreshold, HashFunction<byte[]> hashFunction) throws Exception
Segment Compact Factor : 0.5
homeDir
- the home directory of DataStoreinitLevel
- the initial level when DataStore is createdentrySize
- the redo entry size (i.e., batch size)maxEntries
- the number of redo entries required for updating the underlying address arraysegmentFileSizeMB
- the size of segment file in MBsegmentFactory
- the segment factoryhashLoadThreshold
- the load factor of the underlying address array (hash table)hashFunction
- the hash function for mapping keys to indexes
Exception
- if this dynamic data store cannot be created.public DynamicDataStore(File homeDir, int initLevel, int entrySize, int maxEntries, int segmentFileSizeMB, SegmentFactory segmentFactory, double segmentCompactFactor, double hashLoadThreshold, HashFunction<byte[]> hashFunction) throws Exception
homeDir
- the home directory of DataStoreinitLevel
- the initial level when DataStore is createdentrySize
- the redo entry size (i.e., batch size)maxEntries
- the number of redo entries required for updating the underlying address arraysegmentFileSizeMB
- the size of segment file in MBsegmentFactory
- the segment factorysegmentCompactFactor
- the load factor of segment, below which a segment is eligible for compactionhashLoadThreshold
- the load factor of the underlying address array (hash table)hashFunction
- the hash function for mapping keys to indexes
Exception
- if this dynamic data store cannot be created.Method Detail |
---|
protected DynamicLongArray createAddressArray(int entrySize, int maxEntries, File homeDirectory) throws Exception
Exception
protected long hash(byte[] key)
protected long nextScn()
public void sync() throws IOException
sync
in interface DataStore<byte[],byte[]>
IOException
public void persist() throws IOException
persist
in interface DataStore<byte[],byte[]>
IOException
public byte[] get(byte[] key)
get
in interface DataStore<byte[],byte[]>
public boolean put(byte[] key, byte[] value) throws Exception
put
in interface DataStore<byte[],byte[]>
Exception
public boolean delete(byte[] key) throws Exception
delete
in interface DataStore<byte[],byte[]>
Exception
public void clear() throws IOException
clear
in interface DataStore<byte[],byte[]>
IOException
protected final int getIndex(byte[] key)
protected final int getIndex(long hashCode)
protected boolean putInternal(int index, byte[] key, byte[] value) throws Exception
Exception
protected boolean deleteInternal(int index, byte[] key) throws Exception
Exception
public final int getLevel()
public final int getSplit()
public final int getCapacity()
public final int getUnitCapacity()
public final int getLevelCapacity()
public final int getLoadCount()
public final double getLoadFactor()
public final double getLoadThreshold()
protected void split() throws Exception
Exception
public void rehash() throws Exception
Exception
public String getStatus()
public DataArray getDataArray()
public Iterator<byte[]> keyIterator()
keyIterator
in interface DataStore<byte[],byte[]>
public Iterator<Map.Entry<byte[],byte[]>> iterator()
iterator
in interface Iterable<Map.Entry<byte[],byte[]>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |