Package one.microstream.storage.types
Class StorageDataFileItemIterator.BufferProvider.ConstantSizedBufferProvider
java.lang.Object
one.microstream.storage.types.StorageDataFileItemIterator.BufferProvider.ConstantSizedBufferProvider
- All Implemented Interfaces:
StorageDataFileItemIterator.BufferProvider
- Enclosing interface:
- StorageDataFileItemIterator.BufferProvider
public static final class StorageDataFileItemIterator.BufferProvider.ConstantSizedBufferProvider extends Object implements StorageDataFileItemIterator.BufferProvider
Simple implementation that provides always the same
ByteBuffer
instance with a fixed size.
This is sufficient for reading all entity headers and having the data available for caching of "small"
entities. Normally, the buffer size is downwards capped at the system's page size which also proved
to be the optimal buffer size (anything large gives no significant advantage, anything lower dramatically
reduces performance. Both not surprising, given the fundamental meaning of a page size).-
Nested Class Summary
Nested classes/interfaces inherited from interface one.microstream.storage.types.StorageDataFileItemIterator.BufferProvider
StorageDataFileItemIterator.BufferProvider.ConstantSizedBufferProvider
-
Constructor Summary
Constructors Constructor Description ConstantSizedBufferProvider()
-
Method Summary
Modifier and Type Method Description ByteBuffer
provideBuffer(ByteBuffer byteBuffer, long nextEntityLength)
The passed and returned byte buffer instances are guaranteed to be direct bytebuffer.ByteBuffer
provideInitialBuffer()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface one.microstream.storage.types.StorageDataFileItemIterator.BufferProvider
cleanUp
-
Constructor Details
-
ConstantSizedBufferProvider
public ConstantSizedBufferProvider()
-
-
Method Details
-
provideInitialBuffer
- Specified by:
provideInitialBuffer
in interfaceStorageDataFileItemIterator.BufferProvider
-
provideBuffer
Description copied from interface:StorageDataFileItemIterator.BufferProvider
The passed and returned byte buffer instances are guaranteed to be direct bytebuffer. This has to be ensured via contract instead of proper typing because of the lack of competent typing in the JDK. All byte buffer instances passed to this method are guaranteed to have been created by it. SeeStorageDataFileItemIterator.BufferProvider.provideInitialBuffer()
.- Specified by:
provideBuffer
in interfaceStorageDataFileItemIterator.BufferProvider
- Parameters:
byteBuffer
- the direct byte buffer used so far.nextEntityLength
- the length of the next entity to be read to the buffer.- Returns:
- a byte buffer of apriorate size to hold the next entity's data to be processed sufficiently.
-