Skip to content

Commit

Permalink
dird: refactore member initializers
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Nov 7, 2019
1 parent e07b91a commit b7ac25d
Showing 1 changed file with 94 additions and 95 deletions.
189 changes: 94 additions & 95 deletions core/src/dird/jcr_private.h
Expand Up @@ -47,109 +47,108 @@ class CatalogResource;

/* clang-format off */
struct Resources {
directordaemon::JobResource* job = nullptr; /**< Job resource */
directordaemon::JobResource* verify_job = nullptr; /**< Job resource of verify previous job */
directordaemon::JobResource* previous_job = nullptr; /**< Job resource of migration previous job */
directordaemon::StorageResource* read_storage = nullptr; /**< Selected read storage */
directordaemon::StorageResource* write_storage = nullptr; /**< Selected write storage */
directordaemon::StorageResource* paired_read_write_storage = nullptr; /*< Selected paired storage (savedwrite_storage or read_storage)*/
directordaemon::ClientResource* client = nullptr; /**< Client resource */
directordaemon::PoolResource* pool = nullptr; /**< Pool resource = write for migration */
directordaemon::PoolResource* rpool = nullptr; /**< Read pool. Used only in migration */
directordaemon::PoolResource* full_pool = nullptr; /**< Full backup pool resource */
directordaemon::PoolResource* vfull_pool = nullptr; /**< Virtual Full backup pool resource */
directordaemon::PoolResource* inc_pool = nullptr; /**< Incremental backup pool resource */
directordaemon::PoolResource* diff_pool = nullptr; /**< Differential backup pool resource */
directordaemon::PoolResource* next_pool = nullptr; /**< Next Pool used for migration/copy and virtual backup */
directordaemon::FilesetResource* fileset = nullptr; /**< FileSet resource */
directordaemon::CatalogResource* catalog = nullptr; /**< Catalog resource */
MessagesResource* messages = nullptr; /**< Default message handler */
POOLMEM* pool_source = nullptr; /**< Where pool came from */
POOLMEM* npool_source = nullptr; /**< Where next pool came from */
POOLMEM* rpool_source = nullptr; /**< Where migrate read pool came from */
POOLMEM* rstore_source = nullptr; /**< Where read storage came from */
POOLMEM* wstore_source = nullptr; /**< Where write storage came from */
POOLMEM* catalog_source = nullptr; /**< Where catalog came from */
alist* read_storage_list = nullptr; /**< Read storage possibilities */
alist* write_storage_list = nullptr; /**< Write storage possibilities */
alist* paired_read_write_storage_list = nullptr; /**< Paired storage possibilities
* (saved write_storage_list or read_storage_list) */
bool run_pool_override = false; /**< Pool override was given on run cmdline */
bool run_full_pool_override = false; /**< Full pool override was given on run cmdline */
bool run_vfull_pool_override = false; /**< Virtual Full pool override was given on run cmdline */
bool run_inc_pool_override = false; /**< Incremental pool override was given on run cmdline */
bool run_diff_pool_override = false; /**< Differential pool override was given on run cmdline */
bool run_next_pool_override = false; /**< Next pool override was given on run cmdline */
directordaemon::JobResource* job{}; /**< Job resource */
directordaemon::JobResource* verify_job{}; /**< Job resource of verify previous job */
directordaemon::JobResource* previous_job{}; /**< Job resource of migration previous job */
directordaemon::StorageResource* read_storage{}; /**< Selected read storage */
directordaemon::StorageResource* write_storage{}; /**< Selected write storage */
directordaemon::StorageResource* paired_read_write_storage{}; /*< Selected paired storage (savedwrite_storage or read_storage)*/
directordaemon::ClientResource* client{}; /**< Client resource */
directordaemon::PoolResource* pool{}; /**< Pool resource = write for migration */
directordaemon::PoolResource* rpool{}; /**< Read pool. Used only in migration */
directordaemon::PoolResource* full_pool{}; /**< Full backup pool resource */
directordaemon::PoolResource* vfull_pool{}; /**< Virtual Full backup pool resource */
directordaemon::PoolResource* inc_pool{}; /**< Incremental backup pool resource */
directordaemon::PoolResource* diff_pool{}; /**< Differential backup pool resource */
directordaemon::PoolResource* next_pool{}; /**< Next Pool used for migration/copy and virtual backup */
directordaemon::FilesetResource* fileset{}; /**< FileSet resource */
directordaemon::CatalogResource* catalog{}; /**< Catalog resource */
MessagesResource* messages{}; /**< Default message handler */
POOLMEM* pool_source{}; /**< Where pool came from */
POOLMEM* npool_source{}; /**< Where next pool came from */
POOLMEM* rpool_source{}; /**< Where migrate read pool came from */
POOLMEM* rstore_source{}; /**< Where read storage came from */
POOLMEM* wstore_source{}; /**< Where write storage came from */
POOLMEM* catalog_source{}; /**< Where catalog came from */
alist* read_storage_list{}; /**< Read storage possibilities */
alist* write_storage_list{}; /**< Write storage possibilities */
alist* paired_read_write_storage_list{}; /**< Paired storage possibilities (saved write_storage_list or read_storage_list) */
bool run_pool_override{}; /**< Pool override was given on run cmdline */
bool run_full_pool_override{}; /**< Full pool override was given on run cmdline */
bool run_vfull_pool_override{}; /**< Virtual Full pool override was given on run cmdline */
bool run_inc_pool_override{}; /**< Incremental pool override was given on run cmdline */
bool run_diff_pool_override{}; /**< Differential pool override was given on run cmdline */
bool run_next_pool_override{}; /**< Next pool override was given on run cmdline */
};

struct JobControlRecordPrivate {
JobControlRecordPrivate() {
RestoreJobId = 0; MigrateJobId = 0; VerifyJobId = 0;
}
pthread_t SD_msg_chan = 0; /**< Message channel thread id */
bool SD_msg_chan_started = false; /**< Message channel thread started */
pthread_cond_t term_wait = PTHREAD_COND_INITIALIZER; /**< Wait for job termination */
pthread_cond_t nextrun_ready = PTHREAD_COND_INITIALIZER; /**< Wait for job next run to become ready */
Resources res; /**< Resources assigned */
TREE_ROOT* restore_tree_root = nullptr; /**< Selected files to restore (some protocols need this info) */
storagedaemon::BootStrapRecord* bsr = nullptr; /**< Bootstrap record -- has everything */
char* backup_format = nullptr; /**< Backup format used when doing a NDMP backup */
char* plugin_options = nullptr; /**< User set options for plugin */
uint32_t SDJobFiles = 0; /**< Number of files written, this job */
uint64_t SDJobBytes = 0; /**< Number of bytes processed this job */
uint32_t SDErrors = 0; /**< Number of non-fatal errors */
volatile int32_t SDJobStatus = 0; /**< Storage Job Status */
volatile int32_t FDJobStatus = 0; /**< File daemon Job Status */
uint32_t DumpLevel = 0; /**< Dump level when doing a NDMP backup */
uint32_t ExpectedFiles = 0; /**< Expected restore files */
uint32_t MediaId = 0; /**< DB record IDs associated with this job */
uint32_t FileIndex = 0; /**< Last FileIndex processed */
utime_t MaxRunSchedTime = 0; /**< Max run time in seconds from Initial Scheduled time */
JobDbRecord jr; /**< Job DB record for current job */
JobDbRecord previous_jr; /**< Previous job database record */
JobControlRecord* mig_jcr = nullptr; /**< JobControlRecord for migration/copy job */
char FSCreateTime[MAX_TIME_LENGTH]{0}; /**< FileSet CreateTime as returned from DB */
char since[MAX_TIME_LENGTH]{0}; /**< Since time */
char PrevJob[MAX_NAME_LENGTH]{0}; /**< Previous job name assiciated with since time */
pthread_t SD_msg_chan{}; /**< Message channel thread id */
bool SD_msg_chan_started{}; /**< Message channel thread started */
pthread_cond_t term_wait = PTHREAD_COND_INITIALIZER; /**< Wait for job termination */
pthread_cond_t nextrun_ready = PTHREAD_COND_INITIALIZER; /**< Wait for job next run to become ready */
Resources res; /**< Resources assigned */
TREE_ROOT* restore_tree_root{}; /**< Selected files to restore (some protocols need this info) */
storagedaemon::BootStrapRecord* bsr{}; /**< Bootstrap record -- has everything */
char* backup_format{}; /**< Backup format used when doing a NDMP backup */
char* plugin_options{}; /**< User set options for plugin */
uint32_t SDJobFiles{}; /**< Number of files written, this job */
uint64_t SDJobBytes{}; /**< Number of bytes processed this job */
uint32_t SDErrors{}; /**< Number of non-fatal errors */
volatile int32_t SDJobStatus{}; /**< Storage Job Status */
volatile int32_t FDJobStatus{}; /**< File daemon Job Status */
uint32_t DumpLevel{}; /**< Dump level when doing a NDMP backup */
uint32_t ExpectedFiles{}; /**< Expected restore files */
uint32_t MediaId{}; /**< DB record IDs associated with this job */
uint32_t FileIndex{}; /**< Last FileIndex processed */
utime_t MaxRunSchedTime{}; /**< Max run time in seconds from Initial Scheduled time */
JobDbRecord jr; /**< Job DB record for current job */
JobDbRecord previous_jr; /**< Previous job database record */
JobControlRecord* mig_jcr{}; /**< JobControlRecord for migration/copy job */
char FSCreateTime[MAX_TIME_LENGTH]{}; /**< FileSet CreateTime as returned from DB */
char since[MAX_TIME_LENGTH]{}; /**< Since time */
char PrevJob[MAX_NAME_LENGTH]{}; /**< Previous job name assiciated with since time */
union {
JobId_t RestoreJobId; /**< Restore JobId specified by UA */
JobId_t MigrateJobId; /**< Migration JobId specified by UA */
JobId_t VerifyJobId; /**< Verify JobId specified by UA */
JobId_t RestoreJobId; /**< Restore JobId specified by UA */
JobId_t MigrateJobId; /**< Migration JobId specified by UA */
JobId_t VerifyJobId; /**< Verify JobId specified by UA */
};
POOLMEM* fname = nullptr; /**< Name to put into catalog */
POOLMEM* client_uname = nullptr; /**< Client uname */
POOLMEM* FDSecureEraseCmd = nullptr; /**< Report: Secure Erase Command */
POOLMEM* SDSecureEraseCmd = nullptr; /**< Report: Secure Erase Command */
POOLMEM* vf_jobids = nullptr; /**< JobIds to use for Virtual Full */
uint32_t replace = 0; /**< Replace option */
int32_t NumVols = 0; /**< Number of Volume used in pool */
int32_t reschedule_count = 0; /**< Number of times rescheduled */
int32_t FDVersion = 0; /**< File daemon version number */
int64_t spool_size = 0; /**< Spool size for this job */
volatile bool sd_msg_thread_done = false; /**< Set when Storage message thread done */
bool IgnoreDuplicateJobChecking = false; /**< Set in migration jobs */
bool IgnoreLevelPoolOverides = false; /**< Set if a cmdline pool was specified */
bool IgnoreClientConcurrency = false; /**< Set in migration jobs */
bool IgnoreStorageConcurrency = false; /**< Set in migration jobs */
bool spool_data = false; /**< Spool data in SD */
bool acquired_resource_locks = false; /**< Set if resource locks acquired */
bool term_wait_inited = false; /**< Set when cond var inited */
bool nextrun_ready_inited = false; /**< Set when cond var inited */
bool fn_printed = false; /**< Printed filename */
bool needs_sd = false; /**< Set if SD needed by Job */
bool cloned = false; /**< Set if cloned */
bool unlink_bsr = false; /**< Unlink bsr file created */
bool VSS = false; /**< VSS used by FD */
bool Encrypt = false; /**< Encryption used by FD */
bool no_maxtime = false; /**< Don't check Max*Time for this JobControlRecord */
bool keep_sd_auth_key = false; /**< Clear or not the SD auth key after connection*/
bool use_accurate_chksum = false; /**< Use or not checksum option in accurate code */
bool sd_canceled = false; /**< Set if SD canceled */
bool remote_replicate = false; /**< Replicate data to remote SD */
bool HasQuota = false; /**< Client has quota limits */
bool HasSelectedJobs = false; /**< Migration/Copy Job did actually select some JobIds */
directordaemon::ClientConnectionHandshakeMode connection_handshake_try_ =
directordaemon::ClientConnectionHandshakeMode::kUndefined;
POOLMEM* fname{}; /**< Name to put into catalog */
POOLMEM* client_uname{}; /**< Client uname */
POOLMEM* FDSecureEraseCmd{}; /**< Report: Secure Erase Command */
POOLMEM* SDSecureEraseCmd{}; /**< Report: Secure Erase Command */
POOLMEM* vf_jobids{}; /**< JobIds to use for Virtual Full */
uint32_t replace{}; /**< Replace option */
int32_t NumVols{}; /**< Number of Volume used in pool */
int32_t reschedule_count{}; /**< Number of times rescheduled */
int32_t FDVersion{}; /**< File daemon version number */
int64_t spool_size{}; /**< Spool size for this job */
volatile bool sd_msg_thread_done{}; /**< Set when Storage message thread done */
bool IgnoreDuplicateJobChecking{}; /**< Set in migration jobs */
bool IgnoreLevelPoolOverides{}; /**< Set if a cmdline pool was specified */
bool IgnoreClientConcurrency{}; /**< Set in migration jobs */
bool IgnoreStorageConcurrency{}; /**< Set in migration jobs */
bool spool_data{}; /**< Spool data in SD */
bool acquired_resource_locks{}; /**< Set if resource locks acquired */
bool term_wait_inited{}; /**< Set when cond var inited */
bool nextrun_ready_inited{}; /**< Set when cond var inited */
bool fn_printed{}; /**< Printed filename */
bool needs_sd{}; /**< Set if SD needed by Job */
bool cloned{}; /**< Set if cloned */
bool unlink_bsr{}; /**< Unlink bsr file created */
bool VSS{}; /**< VSS used by FD */
bool Encrypt{}; /**< Encryption used by FD */
bool no_maxtime{}; /**< Don't check Max*Time for this JobControlRecord */
bool keep_sd_auth_key{}; /**< Clear or not the SD auth key after connection*/
bool use_accurate_chksum{}; /**< Use or not checksum option in accurate code */
bool sd_canceled{}; /**< Set if SD canceled */
bool remote_replicate{}; /**< Replicate data to remote SD */
bool HasQuota{}; /**< Client has quota limits */
bool HasSelectedJobs{}; /**< Migration/Copy Job did actually select some JobIds */
directordaemon::ClientConnectionHandshakeMode connection_handshake_try_{
directordaemon::ClientConnectionHandshakeMode::kUndefined};
};
/* clang-format on */

Expand Down

0 comments on commit b7ac25d

Please sign in to comment.