def generate_directory_structure(self): """ Generates the expected directory structure for the backup :return: directory map """ json_helper = JSONGenerator("directory_structure.json", self.backupset.__dict__) json_helper.generate_json() backupset = json_helper.object[self.backupset.name] curr_backup_len = len(backupset) - 1 if curr_backup_len != self.backupset.number_of_backups: for i in range(curr_backup_len, self.backupset.number_of_backups): backupset["backups" + str(i)] = backupset["backups"] for backup in backupset: b = backupset[backup] if not isinstance(b, dict): continue for bucket in b: buck = b[bucket] if not isinstance(buck, dict): continue if self.backupset.disable_bucket_config and "bucket-config.json" in buck: del buck["bucket-config.json"] if self.backupset.disable_gsi_indexes and "gsi.json" in buck: del buck["gsi.json"] if self.backupset.disable_views and "views.json" in buck: del buck["views.json"] if self.backupset.disable_data and "data" in bucket: del buck["data"] else: buck["data"] = {} for i in range(0, int(self.backupset.threads)): shard = "shard_{0}.fdb".format(i) buck["data"][shard] = shard return json_helper.object
def generate_directory_structure(self): """ Generates the expected directory structure for the backup :return: directory map """ json_helper = JSONGenerator("directory_structure.json", self.backupset.__dict__) json_helper.generate_json() backupset = json_helper.object[self.backupset.name] curr_backup_len = len(backupset) - 1 if curr_backup_len != self.backupset.number_of_backups: for i in range(curr_backup_len, self.backupset.number_of_backups): backupset["backups" + str(i)] = backupset["backups"] for backup in backupset: b = backupset[backup] if not isinstance(b, dict): continue for bucket in b: buck = b[bucket] if not isinstance(buck, dict): continue if self.backupset.disable_bucket_config and 'bucket-config.json' in buck: del buck['bucket-config.json'] if self.backupset.disable_gsi_indexes and 'gsi.json' in buck: del buck['gsi.json'] if self.backupset.disable_views and 'views.json' in buck: del buck['views.json'] if self.backupset.disable_data and 'data' in bucket: del buck['data'] else: buck['data'] = {} for i in range(0, int(self.backupset.threads)): shard = 'shard_{0}.fdb'.format(i) buck['data'][shard] = shard return json_helper.object
def generate_backup_meta_json(self): """ Generates expected backup metadata json :return: backup meta map """ json_helper = JSONGenerator("backup-meta.json", self.backupset.__dict__) json_helper.generate_json() return json_helper.object