QtCraft API C++ classes QML types Handbook

QcBackupRunner Class

Copies world snapshots in a background thread (decision E-256), one at a time, so /backup does not hold up the ticks. More...

Header: #include <server/backup/QcBackupRunner.h>

Public Types

Done

Public Functions

QcBackupRunner()
QcBackupRunner(const QcBackupRunner &)
~QcBackupRunner()
void poll()
bool running() const
void setBeforeCopy(std::function<void ()> hook)
void start(QcWorldBackup::Snapshot snapshot, QcBackupRunner::Done done)
void wait()
QcBackupRunner &operator=(const QcBackupRunner &)

Detailed Description

The result comes back to the owner's thread in poll(), which the server calls every tick; the hand-over is a mutex-guarded mailbox (decision E-010).

Member Type Documentation

[alias] QcBackupRunner::Done

Called with the result of a copy: the summary of the backup or the error.

Member Function Documentation

[noexcept default] QcBackupRunner::QcBackupRunner()

Default-constructs an instance of QcBackupRunner.

[delete] QcBackupRunner::QcBackupRunner(const QcBackupRunner &)

Copy-constructs an instance of QcBackupRunner. This function is deleted.

[noexcept] QcBackupRunner::~QcBackupRunner()

Waits for a running copy (its report is dropped).

void QcBackupRunner::poll()

Reports a finished copy.

bool QcBackupRunner::running() const

Returns whether a copy runs (or has finished and was not reported yet).

void QcBackupRunner::setBeforeCopy(std::function<void ()> hook)

Test hook: hook runs in the background thread before the copy starts.

void QcBackupRunner::start(QcWorldBackup::Snapshot snapshot, QcBackupRunner::Done done)

Copies snapshot in the background; done runs in poll() or wait() afterwards.

void QcBackupRunner::wait()

Blocks until a running copy has finished and reports it.

[delete] QcBackupRunner &QcBackupRunner::operator=(const QcBackupRunner &)

Copy-assigns other to this QcBackupRunner instance. This function is deleted.