use of com.palantir.atlasdb.backup.api.PrepareBackupRequest in project atlasdb by palantir.
the class AtlasBackupService method prepareBackup.
public Set<Namespace> prepareBackup(Set<Namespace> namespaces) {
PrepareBackupRequest request = PrepareBackupRequest.of(namespaces);
PrepareBackupResponse response = atlasBackupClient.prepareBackup(authHeader, request);
return response.getSuccessful().stream().peek(this::storeBackupToken).map(InProgressBackupToken::getNamespace).collect(Collectors.toSet());
}
use of com.palantir.atlasdb.backup.api.PrepareBackupRequest in project atlasdb by palantir.
the class AtlasBackupService method prepareBackup.
public Set<AtlasService> prepareBackup(Set<AtlasService> atlasServices) {
throwIfClosed(atlasServices);
Set<AtlasService> inProgressAndProposedBackups = Sets.union(atlasServices, inProgressBackups.keySet());
AtlasServices.throwIfAtlasServicesCollide(inProgressAndProposedBackups);
Map<Namespace, AtlasService> namespaceToServices = KeyedStream.of(atlasServices).mapKeys(AtlasService::getNamespace).collectToMap();
PrepareBackupRequest request = PrepareBackupRequest.of(namespaceToServices.keySet());
PrepareBackupResponse response = atlasBackupClient.prepareBackup(authHeader, request);
Map<AtlasService, InProgressBackupToken> tokensPerService = KeyedStream.of(response.getSuccessful()).mapKeys(token -> namespaceToServices.get(token.getNamespace())).collectToMap();
KeyedStream.stream(tokensPerService).forEach(this::storeBackupToken);
return tokensPerService.keySet();
}
Aggregations