//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: org.neo4j.backup.impl.BackupOutcome executeBackup(org.neo4j.helpers.HostnamePort hostnamePort, java.nio.file.Path to, org.neo4j.backup.impl.ConsistencyCheck consistencyCheck, org.neo4j.kernel.configuration.Config config, long timeout, boolean forensics) throws ToolFailureException internal virtual BackupOutcome ExecuteBackup(HostnamePort hostnamePort, Path to, ConsistencyCheck consistencyCheck, Config config, long timeout, bool forensics) { try { _systemOut.println("Performing backup from '" + hostnamePort + "'"); string host = hostnamePort.Host; int port = hostnamePort.Port; BackupOutcome outcome = _backupProtocolService.doIncrementalBackupOrFallbackToFull(host, port, DatabaseLayout.of(to.toFile()), consistencyCheck, config, timeout, forensics); _systemOut.println("Done"); return(outcome); } catch (Exception e) when(e is UnexpectedStoreVersionException || e is IncrementalBackupNotPossibleException) { throw new ToolFailureException(e.Message, e); } catch (MismatchingStoreIdException e) { throw new ToolFailureException(string.format(MISMATCHED_STORE_ID, e.Expected, e.Encountered)); } catch (ComException e) { throw new ToolFailureException("Couldn't connect to '" + hostnamePort + "'", e); } }
public static void Main(string[] args) { Console.Error.WriteLine("WARNING: neo4j-backup is deprecated and support for it will be removed in a future\n" + "version of Neo4j; please use neo4j-admin backup instead.\n"); try { using (BackupProtocolService backupProtocolService = backupProtocolService()) { BackupTool tool = new BackupTool(backupProtocolService, System.out); BackupOutcome backupOutcome = tool.Run(args); if (!backupOutcome.Consistent) { ExitFailure("WARNING: The database is inconsistent."); } } } catch (Exception e) { Console.WriteLine("Backup failed."); ExitFailure(e.Message); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static BackupResult backup(String host, int port, java.nio.file.Path targetDirectory) throws Exception public static BackupResult Backup(string host, int port, Path targetDirectory) { MemoryStream outputStream = new MemoryStream(); bool consistent = true; bool transientFailure = false; bool failure = false; try { using (BackupProtocolService backupProtocolService = backupProtocolService(outputStream)) { BackupOutcome backupOutcome = backupProtocolService.DoIncrementalBackupOrFallbackToFull(host, port, DatabaseLayout.of(targetDirectory.toFile()), ConsistencyCheck.FULL, Config.defaults(), BackupClient.BIG_READ_TIMEOUT, false); consistent = backupOutcome.Consistent; } } catch (Exception t) { if (_isTransientError.test(t)) { transientFailure = true; } else { failure = true; throw t; } } finally { if (!consistent || failure) { FlushToStandardOutput(outputStream); } IOUtils.closeAllSilently(outputStream); } return(new BackupResult(consistent, transientFailure)); }