Region

A storage for REGION_SIZE^3 offsets on a disk.

Format: Header consists of REGION_SIZE^3 records of 4 bytes. record = position << 8 | (size & 0xFF) where position is the number of first sector and size is the total number of sectors that are used by a chunk. Header is followed by sectors each of size SECTOR_SIZE. 4096

Region files are named like x_y_z.region.

Constructors

this
this()
Undocumented in source.
this
this(string regionFilename)
Undocumented in source.

Members

Functions

chunkTimestamp
TimestampType chunkTimestamp(ChunkRegionPos chunkPosition)
Undocumented in source. Be warned that the author may not have intended to support it.
close
void close()

Closes the underlyiing file handle. Renders Region unusable after this.

getChunkStoreInfo
ChunkStoreInfo getChunkStoreInfo(ChunkRegionPos chunkPosition)
Undocumented in source. Be warned that the author may not have intended to support it.
isChunkOnDisk
bool isChunkOnDisk(ChunkRegionPos chunkPosition)

Returns true if chunk is presented on disk. Positions are region local. I.e. 0..REGION_SIZE

readChunk
ubyte[] readChunk(ChunkRegionPos chunkPosition, ubyte[] outBuffer, TimestampType timestamp)

Reads chunk from a file. Chunks positions are region local in range 0..REGION_SIZE. outBuffer should be big enough to store chunk of any size.

writeChunk
void writeChunk(ChunkRegionPos chunkPosition, ubyte[] blockData, TimestampType timestamp)

Writes chunk at chunkPosition with data blockData to disk. Positions are region local. I.e. 0..REGION_SIZE

Meta