ChunkManager

Undocumented in source.

Constructors

this
this(ubyte _numLayers)
Undocumented in source.

Members

Functions

addCurrentSnapshotUser
TimestampType addCurrentSnapshotUser(ChunkWorldPos cwp, ubyte layer)

Returns timestamp of current chunk snapshot. Store this timestamp to use in removeSnapshotUser Adding a user to non-existent snapshot of loaded chunk is allowed, since a ChunkLayerSnap.init is returned for such layer. Special TimestampType.max is returned.

areChunksLoaded
bool areChunksLoaded(ChunkWorldPos[] positions)
Undocumented in source. Be warned that the author may not have intended to support it.
clearModifiedChunks
void clearModifiedChunks()

Used on client to clear modified chunks instead of saving them.

commitLayerSnapshot
void commitLayerSnapshot(ChunkWorldPos cwp, WriteBuffer writeBuffer, TimestampType currentTime, ubyte layer)
Undocumented in source. Be warned that the author may not have intended to support it.
getChunkSnapshot
Nullable!ChunkLayerSnap getChunkSnapshot(ChunkWorldPos cwp, ubyte layer, Flag!"Uncompress" uncompress)

returned value isNull if chunk is not loaded/added If uncompress is Yes then tries to convert snapshot to uncompressed. If has users, then uncompressed snapshot copy is returned. Original will not be uncompressed.

getModifiedChunks
ModifiedChunksRange getModifiedChunks()
Undocumented in source. Be warned that the author may not have intended to support it.
hasSnapshot
bool hasSnapshot(ChunkWorldPos cwp, ubyte layer)
Undocumented in source. Be warned that the author may not have intended to support it.
isChunkAdded
bool isChunkAdded(ChunkWorldPos cwp)
Undocumented in source. Be warned that the author may not have intended to support it.
isChunkLoaded
bool isChunkLoaded(ChunkWorldPos cwp)
Undocumented in source. Be warned that the author may not have intended to support it.
iterateChunkSnapshotsAddUsers
SnapshotIterator iterateChunkSnapshotsAddUsers(ChunkWorldPos cwp)
Undocumented in source. Be warned that the author may not have intended to support it.
loadChunk
void loadChunk(ChunkWorldPos cwp)
Undocumented in source. Be warned that the author may not have intended to support it.
numTrackedChunks
size_t numTrackedChunks()
Undocumented in source. Be warned that the author may not have intended to support it.
onSnapshotLoaded
void onSnapshotLoaded(ChunkWorldPos cwp, ChunkLayerItem[] layers, bool markAsModified)

Internal. Called by code which loads chunks from storage.

removeSnapshotUser
void removeSnapshotUser(ChunkWorldPos cwp, TimestampType timestamp, ubyte layer)

Generic removal of snapshot user. Removes chunk if numUsers == 0. Use this to remove added snapshot user. Use timestamp returned from addCurrentSnapshotUser. Removing TimestampType.max is no-op.

setLayerInfo
void setLayerInfo(ubyte layer, ChunkLayerInfo info)
Undocumented in source. Be warned that the author may not have intended to support it.
unloadChunk
void unloadChunk(ChunkWorldPos cwp)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

cancelLoadChunkHandler
void delegate(ChunkWorldPos) cancelLoadChunkHandler;
Undocumented in source.
layerInfos
ChunkLayerInfo[] layerInfos;
Undocumented in source.
loadChunkHandler
void delegate(ChunkWorldPos) loadChunkHandler;
Undocumented in source.
numLayers
ubyte numLayers;
Undocumented in source.
numLoadedChunks
long numLoadedChunks;
Undocumented in source.
onChunkLoadedHandler
void delegate(ChunkWorldPos) onChunkLoadedHandler;
Undocumented in source.
onChunkRemovedHandler
void delegate(ChunkWorldPos) onChunkRemovedHandler;
Undocumented in source.
saveChunkHandler
void delegate(ChunkWorldPos) saveChunkHandler;
Undocumented in source.
totalLayerDataBytes
long totalLayerDataBytes;
Undocumented in source.

Meta