Package be.bagofwords.db.filedb
Class FileDataInterface<T>
- java.lang.Object
-
- be.bagofwords.db.impl.BaseDataInterface<T>
-
- be.bagofwords.db.CoreDataInterface<T>
-
- be.bagofwords.db.filedb.FileDataInterface<T>
-
- Type Parameters:
T-
- All Implemented Interfaces:
DataInterface<T>,be.bagofwords.iterator.DataIterable<be.bagofwords.util.KeyValue<T>>,be.bagofwords.memory.MemoryGobbler,Iterable<be.bagofwords.util.KeyValue<T>>
public class FileDataInterface<T> extends CoreDataInterface<T> implements be.bagofwords.memory.MemoryGobbler
Improvements: 1) Make sure keys can have any distribution (e.g. sequential starting from 0), without affecting performance - either infrequently restructure buckets - or rewrite hashes 2) Support ObjectSerializer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileDataInterface.MetaFile
-
Field Summary
-
Fields inherited from class be.bagofwords.db.CoreDataInterface
updateListenerCollection
-
Fields inherited from class be.bagofwords.db.impl.BaseDataInterface
combinator, isTemporaryDataInterface, name, objectClass, objectSerializer
-
-
Constructor Summary
Constructors Constructor Description FileDataInterface(be.bagofwords.memory.MemoryManager memoryManager, Combinator<T> combinator, Class<T> objectClass, String directory, String name, boolean isTemporaryDataInterface, be.bagofwords.jobs.AsyncJobService asyncJobService, ObjectSerializer<T> objectSerializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longapprSize()protected voiddoClose()voiddropAllData()voidflushImpl()longfreeMemory()longgetMemoryUsage()be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>>iterator()be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>>iterator(KeyFilter keyFilter)be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>>iterator(be.bagofwords.iterator.CloseableIterator<Long> keyIterator)be.bagofwords.iterator.CloseableIterator<Long>keyIterator()voidoptimizeForReading()Tread(long key)voidwrite(long key, T value)voidwrite(be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>> entries)-
Methods inherited from class be.bagofwords.db.CoreDataInterface
flush, getCoreDataInterface, registerUpdateListener
-
Methods inherited from class be.bagofwords.db.impl.BaseDataInterface
apprDataChecksum, close, exactSize, finalize, getCombinator, getName, getObjectClass, getObjectSerializer, ifNotClosed, isTemporaryDataInterface, wasClosed
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface be.bagofwords.db.DataInterface
cachedValueIterator, increaseCount, increaseCount, increaseCount, increaseCount, iterator, iterator, mightContain, mightContain, read, read, readCount, readCount, readCount, remove, remove, stream, stream, stream, stream, streamKeys, streamValues, streamValues, streamValues, streamValues, streamValues, valueIterator, valueIterator, valueIterator, valueIterator, valueIterator, write, write, write
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
FileDataInterface
public FileDataInterface(be.bagofwords.memory.MemoryManager memoryManager, Combinator<T> combinator, Class<T> objectClass, String directory, String name, boolean isTemporaryDataInterface, be.bagofwords.jobs.AsyncJobService asyncJobService, ObjectSerializer<T> objectSerializer)
-
-
Method Detail
-
read
public T read(long key)
- Specified by:
readin interfaceDataInterface<T>
-
write
public void write(long key, T value)- Specified by:
writein interfaceDataInterface<T>
-
write
public void write(be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>> entries)
- Specified by:
writein interfaceDataInterface<T>
-
iterator
public be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>> iterator(be.bagofwords.iterator.CloseableIterator<Long> keyIterator)
- Specified by:
iteratorin interfaceDataInterface<T>
-
iterator
public be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>> iterator()
-
iterator
public be.bagofwords.iterator.CloseableIterator<be.bagofwords.util.KeyValue<T>> iterator(KeyFilter keyFilter)
- Specified by:
iteratorin interfaceDataInterface<T>
-
keyIterator
public be.bagofwords.iterator.CloseableIterator<Long> keyIterator()
- Specified by:
keyIteratorin interfaceDataInterface<T>
-
freeMemory
public long freeMemory()
- Specified by:
freeMemoryin interfacebe.bagofwords.memory.MemoryGobbler
-
getMemoryUsage
public long getMemoryUsage()
- Specified by:
getMemoryUsagein interfacebe.bagofwords.memory.MemoryGobbler
-
apprSize
public long apprSize()
- Specified by:
apprSizein interfaceDataInterface<T>- Specified by:
apprSizein interfacebe.bagofwords.iterator.DataIterable<T>
-
flushImpl
public void flushImpl()
- Specified by:
flushImplin classCoreDataInterface<T>
-
optimizeForReading
public void optimizeForReading()
- Specified by:
optimizeForReadingin interfaceDataInterface<T>
-
doClose
protected void doClose()
- Specified by:
doClosein classBaseDataInterface<T>
-
dropAllData
public void dropAllData()
- Specified by:
dropAllDatain interfaceDataInterface<T>
-
-