25#ifndef FBCPP_DATABASE_MANAGER_H
26#define FBCPP_DATABASE_MANAGER_H
28#include "ServiceManager.h"
139 shutdownMode = value;
156 shutdownType = value;
165 return shutdownTimeout;
173 shutdownTimeout = value;
195 std::string database;
196 std::optional<ReplicaMode> replicaMode;
197 std::optional<ShutdownMode> shutdownMode;
198 std::optional<ShutdownType> shutdownType;
199 std::optional<int> shutdownTimeout;
200 std::optional<bool> online;
231 return verboseOutput;
239 verboseOutput = std::move(value);
248 return parallelWorkers;
256 parallelWorkers = value;
316 return ignoreChecksum;
324 ignoreChecksum = value;
414 std::string database;
416 std::optional<std::uint32_t> parallelWorkers;
418 bool validate =
false;
420 bool ignoreChecksum =
false;
421 bool killShadows =
false;
423 bool checkDb =
false;
425 bool upgradeDb =
false;
Executes configuration and maintenance operations through the Firebird service manager.
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.
DatabasePropertiesOptions & setReplicaMode(ReplicaMode value)
Sets the replica mode.
const std::optional< bool > & getOnline() const
Returns whether the database should be brought online.
const std::optional< ReplicaMode > & getReplicaMode() const
Returns the replica mode.
DatabasePropertiesOptions & setShutdownMode(ShutdownMode value)
Sets the shutdown mode.
const std::optional< ShutdownMode > & getShutdownMode() const
Returns the shutdown mode.
const std::optional< ShutdownType > & getShutdownType() const
Returns the shutdown type.
const std::optional< int > & getShutdownTimeout() const
Returns the shutdown timeout in seconds.
DatabasePropertiesOptions & setShutdownType(ShutdownType value)
Sets the shutdown type.
DatabasePropertiesOptions & setShutdownTimeout(int value)
Sets the shutdown timeout in seconds.
DatabasePropertiesOptions & setOnline(bool value)
Sets whether the database should be brought online.
DatabasePropertiesOptions & setDatabase(const std::string &value)
Sets the database path to be configured.
Represents options used to run a database maintenance operation through the service manager.
DatabaseRepairOptions & setFull(bool value)
Sets whether full validation should be run.
bool getIgnoreChecksum() const
Returns whether checksum verification is configured to be ignored.
DatabaseRepairOptions & setKillShadows(bool value)
Sets whether killing database shadows should be run.
DatabaseRepairOptions & setUpgradeDb(bool value)
Sets whether database upgrade should be run.
const std::optional< std::uint32_t > & getParallelWorkers() const
Returns the requested number of parallel workers.
DatabaseRepairOptions & setSweep(bool value)
Sets whether database sweep should be run.
DatabaseRepairOptions & setVerboseOutput(ServiceManager::VerboseOutput value)
Sets the verbose output callback.
bool getUpgradeDb() const
Returns whether database upgrade is configured to be run.
DatabaseRepairOptions & setCheckDb(bool value)
Sets whether checking only metadata/structure should 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.
DatabaseRepairOptions & setIcu(bool value)
Sets whether recreating ICU indexes should be run.
DatabaseRepairOptions & setIgnoreChecksum(bool value)
Sets whether checksum verification should be ignored.
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.
DatabaseRepairOptions & setParallelWorkers(std::uint32_t value)
Sets the requested number of parallel workers.
DatabaseRepairOptions & setMend(bool value)
Sets whether database mending should be run.
bool getFull() const
Returns whether full validation is configured to be run.
DatabaseRepairOptions & setDatabase(const std::string &value)
Sets the database path to be maintained.
DatabaseRepairOptions & setValidate(bool value)
Sets whether database validation should be run.
Represents a connection to the Firebird service manager.
ServiceManager(Client &client, const ServiceManagerOptions &options={})
Attaches to the service manager specified by the given options.
std::function< void(std::string_view line)> VerboseOutput
Function invoked when a verbose service output line is available.
ShutdownType
Shutdown type for a Firebird database.
@ DENY_TRANSACTIONS
Deny new transactions: waits for existing transactions to finish.
@ FORCED
Forced shutdown: disconnects all users immediately after the timeout.
@ DENY_ATTACHMENTS
Deny new attachments: waits for existing connections to finish.
ShutdownMode
Shutdown mode for a Firebird database.
@ SINGLE
Single-user shutdown.
@ NORMAL
Normal online state.
@ FULL
Full exclusive shutdown.
@ MULTI
Multi-user shutdown.