- 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.
- commitSnapshots
void commitSnapshots(TimestampType currentTime)
called at the end of tick
- 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
HashSet!ChunkWorldPos getModifiedChunks()
Undocumented in source. Be warned that the author may not have intended to support it.
- getOrCreateWriteBuffer
WriteBuffer* getOrCreateWriteBuffer(ChunkWorldPos cwp, ubyte layer, WriteBufferPolicy policy, bool allowNonLoaded)
Returns writeable copy of current chunk snapshot.
This buffer is valid until commit.
After commit this buffer becomes next immutable snapshot.
Returns null if chunk is not added and/or not loaded.
If write buffer was not yet created then it is created based on policy.
- getWriteBuffers
WriteBuffer[ChunkWorldPos] getWriteBuffers(ubyte layer)
Returns all write buffers. You can modify data in write buffers, but not
hashmap itself.
Can be used for metadata update before commit.
- 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.
- onSnapshotLoaded
void onSnapshotLoaded(ChunkWorldPos cwp, ChunkLayerItem[] layers, bool needsSave)
Internal. Called by code which loads chunks from storage.
LoadedChunk is a type that has following members:
ChunkHeaderItem getHeader()
ChunkLayerItem getLayer()
- onSnapshotSaved
void onSnapshotSaved(ChunkWorldPos cwp, ChunkLayerTimestampItem[] timestamps)
Internal. Called by code which saves chunks to storage.
SavedChunk is a type that has following memeber:
ChunkHeaderItem getHeader()
ChunkLayerTimestampItem getLayerTimestamp()
- 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.
- save
void save()
Performs save of all modified chunks.
Modified chunks are those that were committed.
Perform save right after commit.
- setExternalChunkObservers
void setExternalChunkObservers(ChunkWorldPos cwp, size_t numExternalObservers)
Sets number of users of chunk at cwp.
If total chunk users if greater than zero, then chunk is loaded,
if equal to zero, chunk will be unloaded.
- setLayerInfo
void setLayerInfo(ChunkLayerInfo info, ubyte layer)
Undocumented in source. Be warned that the author may not have intended to support it.
- setup
void setup(ubyte _numLayers)
Undocumented in source. Be warned that the author may not have intended to support it.