QcServerPersistence Class
Opening and saving the world of the server: world info, chunks with their block entities and entities (through QcChunkIo, read when they are needed), pending block updates and players. More...
| Header: | #include <server/storage/QcServerPersistence.h> |
Public Types
Public Functions
| QcServerPersistence(const QcServerPersistence &) | |
| QcServerPersistence(QcServerPersistence &&) | |
| const QcServerPersistence::DamagedFile & | damagedFile() const |
| bool | hasStorage() const |
| bool | manyUnsavedChunks() const |
| void | noteWarnings(const QStringList &warnings) |
| QcStatus | open() |
| const QStringList & | openWarnings() const |
| QcPlayerStorage::Result | readPlayer(const QString &name) const |
| QcStatus | save() |
| void | saveInBackground() |
| bool | saveRunning() const |
| bool | savesFailing() const |
| std::optional<QcStatus> | takeNewFailure() |
| void | waitForStorage() |
| bool | worldInUse() const |
| bool | worldTooOld() const |
| QcServerPersistence & | operator=(QcServerPersistence &&) |
| QcServerPersistence & | operator=(const QcServerPersistence &) |
Static Public Members
| const QStringView | lockFileName |
Detailed Description
A save hands everything of the loaded chunks and world.json and blockupdates.qce to QcChunkIo, which writes them with the unloaded chunks waiting in memory as one (decision E-373); players are written at once.
Member Type Documentation
[alias] QcServerPersistence::DamagedFile
A damaged file of a world and what it held (QcDamagedFile).
[alias] QcServerPersistence::DamagedPart
What a damaged file held (QcDamagedPart).
Member Function Documentation
[delete] QcServerPersistence::QcServerPersistence(const QcServerPersistence &)
Copy-constructs an instance of QcServerPersistence. This function is deleted.
[delete] QcServerPersistence::QcServerPersistence(QcServerPersistence &&)
Move-constructs an instance of QcServerPersistence. This function is deleted.
const QcServerPersistence::DamagedFile &QcServerPersistence::damagedFile() const
Returns the damaged per-region file that made open() refuse the world.
bool QcServerPersistence::hasStorage() const
Returns whether the world is kept in a directory.
bool QcServerPersistence::manyUnsavedChunks() const
Returns whether more unloaded chunks wait in memory than the limit unsavedChunks allows.
void QcServerPersistence::noteWarnings(const QStringList &warnings)
Logs warnings and keeps them for the players.
QcStatus QcServerPersistence::open()
Opens or creates the world directory given in the config (no-op without one); returns an error when it cannot.
const QStringList &QcServerPersistence::openWarnings() const
Returns the problems found while opening the world (missing mods, unknown blocks); it still opened.
QcPlayerStorage::Result QcServerPersistence::readPlayer(const QString &name) const
Returns the player name as the latest save handed his file over or as it is on disk (never saved: no player); without storage a player who was never saved.
QcStatus QcServerPersistence::save()
Writes everything and waits for it; returns the first error (see QcServer::save). No-op without storage.
void QcServerPersistence::saveInBackground()
The same in the background (autosave, a player leaving): the tick does not wait for the disk; results come from takeNewFailure().
bool QcServerPersistence::saveRunning() const
Returns whether a save in the background has not finished yet (at most one autosave runs at a time).
bool QcServerPersistence::savesFailing() const
Returns whether the latest save failed (no early save until one succeeds).
std::optional<QcStatus> QcServerPersistence::takeNewFailure()
Takes the results of finished saves; returns the failure that started a streak of failed saves (one report per streak, decision E-378).
void QcServerPersistence::waitForStorage()
Waits until everything handed to the storage is written (tests, shutting down).
bool QcServerPersistence::worldInUse() const
Returns whether open() failed because another server (in this or another process) has the world open.
bool QcServerPersistence::worldTooOld() const
Returns whether open() failed because the world comes from an older development version.
[delete] QcServerPersistence &QcServerPersistence::operator=(QcServerPersistence &&)
Move-assigns other to this QcServerPersistence instance. This function is deleted.
[delete] QcServerPersistence &QcServerPersistence::operator=(const QcServerPersistence &)
Copy-assigns other to this QcServerPersistence instance. This function is deleted.
Member Variable Documentation
const QStringView QcServerPersistence::lockFileName
Name of the lock file in the world directory, held while the world is open (decision E-093).