25#include "DatabaseManager.h"
30using namespace fbcpp::impl;
37 fbUnique(
getClient().getUtil()->getXpbBuilder(&statusWrapper, fb::IXpbBuilder::SPB_START,
nullptr, 0));
38 builder->insertTag(&statusWrapper, isc_action_svc_properties);
39 builder->insertString(&statusWrapper, isc_spb_dbname, options.
getDatabase().c_str());
43 std::uint8_t modeVal = 0;
47 modeVal = isc_spb_prp_rm_none;
50 modeVal = isc_spb_prp_rm_readonly;
53 modeVal = isc_spb_prp_rm_readwrite;
59 builder->insertBytes(&statusWrapper, isc_spb_prp_replica_mode, &modeVal, 1u);
62 const auto buffer = builder->getBuffer(&statusWrapper);
63 const auto length = builder->getBufferLength(&statusWrapper);
65 startAction(std::vector<std::uint8_t>(buffer, buffer + length));
74 fbUnique(
getClient().getUtil()->getXpbBuilder(&statusWrapper, fb::IXpbBuilder::SPB_START,
nullptr, 0));
76 builder->insertTag(&statusWrapper, isc_action_svc_repair);
77 builder->insertString(&statusWrapper, isc_spb_dbname, options.
getDatabase().c_str());
81 optionsVal |= isc_spb_rpr_sweep_db;
83 optionsVal |= isc_spb_rpr_validate_db;
85 optionsVal |= isc_spb_rpr_mend_db;
87 optionsVal |= isc_spb_rpr_ignore_checksum;
89 optionsVal |= isc_spb_rpr_kill_shadows;
91 optionsVal |= isc_spb_rpr_full;
93 optionsVal |= isc_spb_rpr_check_db;
95 optionsVal |= isc_spb_rpr_icu;
97 optionsVal |= isc_spb_rpr_upgrade_db;
100 builder->insertInt(&statusWrapper, isc_spb_options, optionsVal);
103 builder->insertInt(&statusWrapper, isc_spb_rpr_par_workers,
static_cast<int>(*parallelWorkers));
105 const auto buffer = builder->getBuffer(&statusWrapper);
106 const auto length = builder->getBufferLength(&statusWrapper);
108 startAction(std::vector<std::uint8_t>(buffer, buffer + length));
void setProperties(const DatabasePropertiesOptions &options)
Configures database properties using the provided options.
void repair(const DatabaseRepairOptions &options)
Runs a repair operation using the provided options.
Represents options used to configure database properties through the service manager.
const std::string & getDatabase() const
Returns the database path to be configured.
const std::optional< ReplicaMode > & getReplicaMode() const
Returns the replica mode.
Represents options used to run a database maintenance operation through the service manager.
bool getIgnoreChecksum() const
Returns whether checksum verification is configured to be ignored.
const std::optional< std::uint32_t > & getParallelWorkers() const
Returns the requested number of parallel workers.
bool getUpgradeDb() const
Returns whether database upgrade is configured to be run.
const ServiceManager::VerboseOutput & getVerboseOutput() const
Returns the verbose output callback.
bool getValidate() const
Returns whether database validation is configured to be run.
bool getCheckDb() const
Returns whether checking only metadata/structure is configured to be run.
bool getKillShadows() const
Returns whether killing database shadows is configured to be run.
bool getSweep() const
Returns whether database sweep is configured to be run.
const std::string & getDatabase() const
Returns the database path to be maintained.
bool getIcu() const
Returns whether recreating ICU indexes is configured to be run.
bool getMend() const
Returns whether database mending is configured to be run.
bool getFull() const
Returns whether full validation is configured to be run.
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.
@ READ_ONLY
Read-only replica.
@ READ_WRITE
Read-write replica.
@ NONE
The database is not a replica (operates as primary).