krati.store.index
Class HashIndex
java.lang.Object
krati.store.index.HashIndex
- All Implemented Interfaces:
- Iterable<Map.Entry<byte[],byte[]>>, Index
public class HashIndex
- extends Object
- implements Index
HashIndex is for serving index lookup from main memory and has the
best performance when MemorySegmentFactory
is used to store
indexes in memory.
- Author:
- jwu
Constructor Summary |
HashIndex(File homeDir,
int initLevel,
int batchSize,
int numSyncBatches,
int segmentFileSizeMB,
SegmentFactory segmentFactory)
|
HashIndex(File homeDir,
int initLevel,
int batchSize,
int numSyncBatches,
int segmentFileSizeMB,
SegmentFactory segmentFactory,
HashFunction<byte[]> hashFunction)
|
HashIndex(File homeDir,
int initLevel,
int batchSize,
int numSyncBatches,
SegmentFactory segmentFactory)
|
HashIndex(File homeDir,
SegmentFactory segmentFactory)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HashIndex
public HashIndex(File homeDir,
SegmentFactory segmentFactory)
throws Exception
- Throws:
Exception
HashIndex
public HashIndex(File homeDir,
int initLevel,
int batchSize,
int numSyncBatches,
SegmentFactory segmentFactory)
throws Exception
- Throws:
Exception
HashIndex
public HashIndex(File homeDir,
int initLevel,
int batchSize,
int numSyncBatches,
int segmentFileSizeMB,
SegmentFactory segmentFactory)
throws Exception
- Throws:
Exception
HashIndex
public HashIndex(File homeDir,
int initLevel,
int batchSize,
int numSyncBatches,
int segmentFileSizeMB,
SegmentFactory segmentFactory,
HashFunction<byte[]> hashFunction)
throws Exception
- Throws:
Exception
sync
public void sync()
throws IOException
- Specified by:
sync
in interface Index
- Throws:
IOException
persist
public void persist()
throws IOException
- Specified by:
persist
in interface Index
- Throws:
IOException
clear
public void clear()
throws IOException
- Specified by:
clear
in interface Index
- Throws:
IOException
lookup
public byte[] lookup(byte[] keyBytes)
- Specified by:
lookup
in interface Index
update
public void update(byte[] keyBytes,
byte[] metaBytes)
throws Exception
- Specified by:
update
in interface Index
- Throws:
Exception
keyIterator
public Iterator<byte[]> keyIterator()
- Specified by:
keyIterator
in interface Index
iterator
public Iterator<Map.Entry<byte[],byte[]>> iterator()
- Specified by:
iterator
in interface Iterable<Map.Entry<byte[],byte[]>>
- Specified by:
iterator
in interface Index
Copyright © 2011. All Rights Reserved.