|
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
Go to the documentation of this file.
15 #include "../OSSupport/IsThread.h"
16 #include "../OSSupport/Queue.h"
30 class cWSSchema
abstract
33 cWSSchema(
cWorld * a_World) : m_World(a_World) {}
34 virtual ~cWSSchema() {}
36 virtual bool LoadChunk(
const cChunkCoords & a_Chunk) = 0;
37 virtual bool SaveChunk(
const cChunkCoords & a_Chunk) = 0;
38 virtual const AString GetName(
void)
const = 0;
97 bool LoadChunk(
int a_ChunkX,
int a_ChunkZ);
101 virtual void Execute(
void)
override;
void Initialize(cWorld &a_World, const AString &a_StorageSchemaName, int a_StorageCompressionFactor)
Initializes the storage schemas, ready to be started.
size_t GetSaveQueueLength(void)
std::list< cWSSchema * > cWSSchemaList
virtual ~cWorldStorage() override
void WaitForLoadQueueEmpty(void)
void QueueSaveChunk(int a_ChunkX, int a_ChunkZ)
Queues a chunk to be saved, asynchronously.
cIsThread(AString &&a_ThreadName)
cWSSchemaList m_Schemas
All the storage schemas (all used for loading)
void InitSchemas(int a_StorageCompressionFactor)
virtual void Execute(void) override
This function, overloaded by the descendants, is called in the new thread.
cEvent m_Event
Set when there's any addition to the queues.
bool LoadOneChunk(void)
Loads one chunk from the queue (if any queued); returns true if there was a chunk in the queue to loa...
cQueue< cChunkCoords > m_SaveQueue
The actual world storage class.
AString m_StorageSchemaName
cQueue< cChunkCoords > m_LoadQueue
void WaitForSaveQueueEmpty(void)
size_t GetLoadQueueLength(void)
bool SaveOneChunk(void)
Saves one chunk from the queue (if any queued); returns true if there was a chunk in the queue to sav...
void QueueLoadChunk(int a_ChunkX, int a_ChunkZ)
Queues a chunk to be loaded, asynchronously.
bool LoadChunk(int a_ChunkX, int a_ChunkZ)
Loads the chunk specified; returns true on success, false on failure.
cWSSchema * m_SaveSchema
The one storage schema used for saving.