25#include "BackupManager.h"
29using namespace fbcpp::impl;
35 fbUnique(
getClient().getUtil()->getXpbBuilder(&statusWrapper, fb::IXpbBuilder::SPB_START,
nullptr, 0));
36 builder->insertTag(&statusWrapper, isc_action_svc_backup);
37 builder->insertString(&statusWrapper, isc_spb_dbname, options.
getDatabase().c_str());
41 builder->insertString(&statusWrapper, isc_spb_bkp_file, backupFile.path.c_str());
43 if (backupFile.length)
44 addSpbInt(builder.get(), &statusWrapper, isc_spb_bkp_length, *backupFile.length,
"Backup file length");
48 builder->insertTag(&statusWrapper, isc_spb_verbose);
51 builder->insertInt(&statusWrapper, isc_spb_bkp_parallel_workers,
static_cast<int>(*parallelWorkers));
53 const auto buffer = builder->getBuffer(&statusWrapper);
54 const auto length = builder->getBufferLength(&statusWrapper);
56 startAction(std::vector<std::uint8_t>(buffer, buffer + length));
64 fbUnique(
getClient().getUtil()->getXpbBuilder(&statusWrapper, fb::IXpbBuilder::SPB_START,
nullptr, 0));
65 builder->insertTag(&statusWrapper, isc_action_svc_restore);
69 builder->insertString(&statusWrapper, isc_spb_dbname, databaseFile.path.c_str());
71 if (databaseFile.length)
72 addSpbInt(builder.get(), &statusWrapper, isc_spb_res_length, *databaseFile.length,
"Database file length");
76 builder->insertString(&statusWrapper, isc_spb_bkp_file, backupFile.c_str());
79 &statusWrapper, isc_spb_options, options.
getReplace() ? isc_spb_res_replace : isc_spb_res_create);
82 builder->insertTag(&statusWrapper, isc_spb_verbose);
85 builder->insertInt(&statusWrapper, isc_spb_res_parallel_workers,
static_cast<int>(*parallelWorkers));
87 const auto buffer = builder->getBuffer(&statusWrapper);
88 const auto length = builder->getBufferLength(&statusWrapper);
90 startAction(std::vector<std::uint8_t>(buffer, buffer + length));
void restore(const RestoreOptions &options)
Runs a restore operation using the provided options.
void backup(const BackupOptions &options)
Runs a backup operation using the provided options.
Represents options used to run a backup operation through the service manager.
const std::vector< BackupFileSpec > & getBackupFiles() const
Returns the configured backup file specifications.
const std::string & getDatabase() const
Returns the database path to be backed up.
const ServiceManager::VerboseOutput & getVerboseOutput() const
Returns the verbose output callback.
const std::optional< std::uint32_t > & getParallelWorkers() const
Returns the requested number of parallel workers.
Represents options used to run a restore operation through the service manager.
bool getReplace() const
Returns whether the target database should be replaced.
const std::optional< std::uint32_t > & getParallelWorkers() const
Returns the requested number of parallel workers.
const ServiceManager::VerboseOutput & getVerboseOutput() const
Returns the verbose output callback.
const std::vector< DatabaseFileSpec > & getDatabaseFiles() const
Returns the configured database file specifications.
const std::vector< std::string > & getBackupFiles() const
Returns the backup file paths.
Client & getClient() noexcept
Returns the Client object reference used to create this ServiceManager object.
FbUniquePtr< T > fbUnique(T *obj) noexcept
Creates a unique pointer for a Firebird disposable object.