int syncBackups(int requestedSyncBackups, int requestedAsyncBackups, boolean syncForced) { if (syncForced) { // if force sync enabled, then the sum of the backups requestedSyncBackups += requestedAsyncBackups; } InternalPartitionService partitionService = node.getPartitionService(); int maxBackupCount = partitionService.getMaxBackupCount(); return min(maxBackupCount, requestedSyncBackups); }
int asyncBackups(int requestedSyncBackups, int requestedAsyncBackups, boolean syncForced) { if (syncForced || requestedAsyncBackups == 0) { // if syncForced, then there will never be any async backups (they are forced to become sync) // if there are no asyncBackups then we are also done. return 0; } InternalPartitionService partitionService = node.getPartitionService(); int maxBackupCount = partitionService.getMaxBackupCount(); return min(maxBackupCount - requestedSyncBackups, requestedAsyncBackups); }