abstract class Volume : CloseableMapDB abstraction over raw storage (file, disk partition, memory etc...).
Implementations needs to be thread safe (especially 'ensureAvailable') operation. However updates do not have to be atomic, it is clients responsibility to ensure two threads are not writing/reading into the same location.
Author
Jan Kotek
| <init> |
Volume()MapDB abstraction over raw storage (file, disk partition, memory etc...). Implementations needs to be thread safe (especially 'ensureAvailable') operation. However updates do not have to be atomic, it is clients responsibility to ensure two threads are not writing/reading into the same location. |
| UNSAFE_VOL_FACTORY |
static val UNSAFE_VOL_FACTORY: VolumeFactoryIf |
| assertZeroes |
open fun assertZeroes(startOffset: Long, endOffset: Long): UnitCheck that all bytes between given offsets are zero. This might cross 1MB boundaries |
| clear |
abstract fun clear(startOffset: Long, endOffset: Long): UnitSet all bytes between |
| clearOverlap |
open fun clearOverlap(startOffset: Long, endOffset: Long): Unit |
| close |
abstract fun close(): Unit |
| copyFrom |
open fun copyFrom(input: InputStream): UnitCopy content from InputStream into this Volume. |
| copyTo |
open fun copyTo(inputOffset: Long, target: Volume, targetOffset: Long, size: Long): UnitTransfers data from this Volume into target volume. If its possible, the implementation should override this method to enable direct memory transfer. Caller must respect slice boundaries. ie it is not possible to transfer data which cross slice boundaries. open fun copyTo(to: Volume): UnitCopy content of this volume to another. Target volume might grow, but is never shrank. Target is also not synced open fun copyTo(output: OutputStream): UnitCopy content of this volume to OutputStream. |
| deleteFile |
open fun deleteFile(): Unit |
| ensureAvailable |
abstract fun ensureAvailable(offset: Long): UnitCheck space allocated by Volume is bigger or equal to given offset. So it is safe to write into smaller offsets. |
| fileLoad |
open fun fileLoad(): Boolean If underlying storage is memory-mapped-file, this method will try to load and precache all file data into disk cache. Most likely it will call |
| getByte |
abstract fun getByte(offset: Long): Byte |
| getData |
abstract fun getData(offset: Long, bytes: ByteArray, bytesPos: Int, size: Int): Unit |
| getDataInput |
abstract fun getDataInput(offset: Long, size: Int): DataInput2 |
| getDataInputOverlap |
open fun getDataInputOverlap(offset: Long, size: Int): DataInput2 |
| getFile |
abstract fun getFile(): Filereturns underlying file if it exists |
| getFileLocked |
abstract fun getFileLocked(): Booleanreturn true if this Volume holds exclusive lock over its file |
| getInt |
abstract fun getInt(offset: Long): Int |
| getLong |
abstract fun getLong(offset: Long): Long |
| getPackedLong |
open fun getPackedLong(position: Long): LongUnpack long value from the Volume. Highest 4 bits reused to indicate number of bytes read from Volume. One can use |
| getSixLong |
open fun getSixLong(pos: Long): Long |
| getUnsignedByte |
open fun getUnsignedByte(offset: Long): Int |
| getUnsignedShort |
open fun getUnsignedShort(offset: Long): Int |
| hash |
open fun hash(off: Long, len: Long, seed: Long): LongCalculates XXHash64 from this Volume content. |
| isClosed |
open fun isClosed(): Boolean |
| isReadOnly |
abstract fun isReadOnly(): Boolean |
| isSliced |
abstract fun isSliced(): Boolean |
| length |
abstract fun length(): Long |
| putByte |
abstract fun putByte(offset: Long, value: Byte): Unit |
| putData |
abstract fun putData(offset: Long, src: ByteArray, srcPos: Int, srcSize: Int): Unitabstract fun putData(offset: Long, buf: ByteBuffer): Unit |
| putDataOverlap |
open fun putDataOverlap(offset: Long, src: ByteArray, srcPos: Int, srcSize: Int): Unit |
| putInt |
abstract fun putInt(offset: Long, value: Int): Unit |
| putLong |
abstract fun putLong(offset: Long, value: Long): Unit |
| putPackedLong |
open fun putPackedLong(pos: Long, value: Long): IntPut packed long at given position. |
| putSixLong |
open fun putSixLong(pos: Long, value: Long): Unit |
| putUnsignedByte |
open fun putUnsignedByte(offset: Long, b: Int): Unit |
| putUnsignedShort |
open fun putUnsignedShort(offset: Long, value: Int): Unit |
| sliceSize |
abstract fun sliceSize(): Int
|
| sync |
abstract fun sync(): Unit |
| truncate |
abstract fun truncate(size: Long): Unit |
| ByteArrayVol |
class ByteArrayVol : VolumeCreated by jan on 2/29/16. |
| ByteBufferVol |
abstract class ByteBufferVol : VolumeAbstract Volume over bunch of ByteBuffers It leaves ByteBufferVol details (allocation, disposal) on subclasses. Most methods are final for better performance (JIT compiler can inline those). |
| ByteBufferVolSingle |
abstract class ByteBufferVolSingle : VolumeAbstract Volume over single ByteBuffer, maximal size is 2GB (32bit limit). It leaves ByteBufferVol details (allocation, disposal) on subclasses. Most methods are final for better performance (JIT compiler can inline those). |
| FileChannelVol |
class FileChannelVol : VolumeVolume which uses FileChannel. Uses global lock and does not use mapped memory. |
| RandomAccessFileVol |
class RandomAccessFileVol : VolumeCreated by jan on 2/29/16. |
| ReadOnlyVolume |
class ReadOnlyVolume : VolumeCreated by jan on 2/29/16. |
| SingleByteArrayVol |
class SingleByteArrayVol : VolumeVolume backed by on-heap byte[] with maximal fixed size 2GB. For thread-safety it can not be grown |