IndexedStorageFile_v0

public class IndexedStorageFile_v0 implements Closeable

Class IndexedStorageFile_v0. Provides indexedstoragefile v0 functionality for the Hytale server.

java.lang.Object > IndexedStorageFile_v0

Field Summary

compressionLevel

private int compressionLevel

Field compressionLevel.

contiguousBlobs

private boolean contiguousBlobs

Field contiguousBlobs.

blobCount

private int blobCount

Field blobCount.

segmentSize

private int segmentSize

Field segmentSize.

indexLocks

private StampedLock[] indexLocks

Field indexLocks.

mappedBlobIndexes

private MappedByteBuffer mappedBlobIndexes

Field mappedBlobIndexes.

segmentLocks

private StampedLock[] segmentLocks

Field segmentLocks.

nextSegmentIndexes

private int[] nextSegmentIndexes

Field nextSegmentIndexes.

buffer

final ByteBuffer buffer

Field buffer.

storageFile

final IndexedStorageFile_v0 storageFile

Field storageFile.

header

final ByteBuffer header

Field header.

dst

final byte[] dst

Field dst.

version

final int version

Field version.

indexesSize

final int indexesSize

Field indexesSize.

tempIndexBuffer

final ByteBuffer tempIndexBuffer

Field tempIndexBuffer.

stamp

final long stamp

Field stamp.

indexesLength

final int indexesLength

Field indexesLength.

tempIndexPos

final int tempIndexPos

Field tempIndexPos.

firstSegmentIndex

final int firstSegmentIndex

Field firstSegmentIndex.

segmentIndex2

final int segmentIndex2

Field segmentIndex2.

segmentLock

final StampedLock segmentLock

Field segmentLock.

segmentStamp

final long segmentStamp

Field segmentStamp.

indexesStamp2

final long indexesStamp2

Field indexesStamp2.

value

final int value

Field value.

list

final IntArrayList list

Field list.

indexPos

final int indexPos

Field indexPos.

lock

final StampedLock lock

Field lock.

segmentIndex

final int segmentIndex

Field segmentIndex.

blobHeaderBuffer

final ByteBuffer blobHeaderBuffer

Field blobHeaderBuffer.

compressedLength

final int compressedLength

Field compressedLength.

tempDest

final ByteBuffer tempDest

Field tempDest.

segmentPosition

final long segmentPosition

Field segmentPosition.

dataToRead

final int dataToRead

Field dataToRead.

srcLength

final int srcLength

Field srcLength.

maxCompressedLength

final int maxCompressedLength

Field maxCompressedLength.

dest

final ByteBuffer dest

Field dest.

tempSrc

final ByteBuffer tempSrc

Field tempSrc.

oldFirstSegmentIndex

final int oldFirstSegmentIndex

Field oldFirstSegmentIndex.

segmentsCount

final int segmentsCount

Field segmentsCount.

endSegmentIndex

final int endSegmentIndex

Field endSegmentIndex.

indexesResizeStamp

final long indexesResizeStamp

Field indexesResizeStamp.

next

final int next

Field next.

nextSegmentIndex

final int nextSegmentIndex

Field nextSegmentIndex.

indexesStamp

final long indexesStamp

Field indexesStamp.

dataToWrite

final int dataToWrite

Field dataToWrite.

next2

final int next2

Field next2.

newLength

final int newLength

Field newLength.

newArray

final StampedLock[] newArray

Field newArray.

stamps

final long[] stamps

Field stamps.

segmentOffset

final long segmentOffset

Field segmentOffset.

size

final int size

Field size.

index

private int index

Field index.

cur

final int cur

Field cur.

Method Detail

getTempBuffer

static ByteBuffer getTempBuffer (final int length)

Method getTempBuffer.

Parameters:
final int length

allocateDirect

static ByteBuffer allocateDirect (final int length)

Method allocateDirect.

Parameters:
final int length

open

static IndexedStorageFile_v0 open (@Nonnull final Path path, final OpenOption... options)

Method open.

Parameters:
@Nonnull final Path path
final OpenOption... options

getPath

public Path getPath ()

Method getPath.

getBlobCount

public int getBlobCount ()

Method getBlobCount.

getSegmentSize

public int getSegmentSize ()

Method getSegmentSize.

getCompressionLevel

public int getCompressionLevel ()

Method getCompressionLevel.

setCompressionLevel

public void setCompressionLevel (final int compressionLevel)

Method setCompressionLevel.

Parameters:
final int compressionLevel

isContiguousBlobs

public boolean isContiguousBlobs ()

Method isContiguousBlobs.

setContiguousBlobs

public void setContiguousBlobs (final boolean contiguousBlobs)

Method setContiguousBlobs.

Parameters:
final boolean contiguousBlobs

create

protected IndexedStorageFile_v0 create (final int blobCount, final int segmentSize)

Method create.

Parameters:
final int blobCount
final int segmentSize

writeHeader

protected void writeHeader (final int blobCount, final int segmentSize)

Method writeHeader.

Parameters:
final int blobCount
final int segmentSize

readHeader

protected void readHeader ()

Method readHeader.

memoryMapBlobIndexes

protected void memoryMapBlobIndexes ()

Method memoryMapBlobIndexes.

readNextIndexes

protected void readNextIndexes ()

Method readNextIndexes.

processTempIndexes

protected void processTempIndexes ()

Method processTempIndexes.

clearSegments

protected int clearSegments (final int firstSegmentIndex, @Nonnull final ByteBuffer tempIndexBuffer)

Method clearSegments.

Parameters:
final int firstSegmentIndex
@Nonnull final ByteBuffer tempIndexBuffer

size

public long size ()

Method size.

segmentSize

public int segmentSize ()

Method segmentSize.

segmentCount

public int segmentCount ()

Method segmentCount.

keys

public IntList keys ()

Method keys.

readBlobLength

public int readBlobLength (final int blobIndex)

Method readBlobLength.

Parameters:
final int blobIndex

readBlobCompressedLength

public int readBlobCompressedLength (final int blobIndex)

Method readBlobCompressedLength.

Parameters:
final int blobIndex

readBlob

public ByteBuffer readBlob (final int blobIndex)

Method readBlob.

Parameters:
final int blobIndex

readBlobHeader

protected ByteBuffer readBlobHeader (final int firstSegmentIndex)

Method readBlobHeader.

Parameters:
final int firstSegmentIndex

readSegments

protected ByteBuffer readSegments (final int firstSegmentIndex, final int compressedLength, @Nonnull final ByteBuffer tempHeaderBuffer)

Method readSegments.

Parameters:
final int firstSegmentIndex
final int compressedLength
@Nonnull final ByteBuffer tempHeaderBuffer

writeBlob

public void writeBlob (final int blobIndex, @Nonnull final ByteBuffer src)

Method writeBlob.

Parameters:
final int blobIndex
@Nonnull final ByteBuffer src

removeBlob

public void removeBlob (final int blobIndex)

Method removeBlob.

Parameters:
final int blobIndex

writeSegments

protected int writeSegments (final int blobIndex, @Nonnull final ByteBuffer data)

Method writeSegments.

Parameters:
final int blobIndex
@Nonnull final ByteBuffer data

findFreeSegment

private SegmentRangeLock findFreeSegment (final int count)

Method findFreeSegment.

Parameters:
final int count

getNextIndex

protected int getNextIndex (final int segmentIndex)

Method getNextIndex.

Parameters:
final int segmentIndex

getSegmentLock

protected StampedLock getSegmentLock (final int segmentIndex)

Method getSegmentLock.

Parameters:
final int segmentIndex

tryWriteLockSegmentRange

protected SegmentRangeLock tryWriteLockSegmentRange (final int start, final int count)

Method tryWriteLockSegmentRange.

Parameters:
final int start
final int count

indexesLength

protected int indexesLength ()

Method indexesLength.

segmentsBase

protected long segmentsBase ()

Method segmentsBase.

segmentOffset

protected long segmentOffset (final int segmentIndex)

Method segmentOffset.

Parameters:
final int segmentIndex

segmentPosition

protected long segmentPosition (final int segmentIndex)

Method segmentPosition.

Parameters:
final int segmentIndex

positionToSegment

protected int positionToSegment (final long position)

Method positionToSegment.

Parameters:
final long position

blobHeaderPosition

protected long blobHeaderPosition (final int segmentIndex)

Method blobHeaderPosition.

Parameters:
final int segmentIndex

requiredSegments

protected int requiredSegments (final long dataLength)

Method requiredSegments.

Parameters:
final long dataLength

lock

public FileLock lock ()

Method lock.

force

public void force (final boolean metaData)

Method force.

Parameters:
final boolean metaData

close

public void close ()

Method close.

toString

public String toString ()

Method toString.

length

public int length ()

Method length.

unlockRead

protected void unlockRead ()

Method unlockRead.

unlockWrite

protected void unlockWrite ()

Method unlockWrite.