Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/backup/dump/postgres.rb')
-rw-r--r--lib/backup/dump/postgres.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/backup/dump/postgres.rb b/lib/backup/dump/postgres.rb
index 1a5128b5a6b..80a49971140 100644
--- a/lib/backup/dump/postgres.rb
+++ b/lib/backup/dump/postgres.rb
@@ -4,14 +4,21 @@ module Backup
class Postgres
include Backup::Helper
+ # Owner can read/write, group no permission, others no permission
FILE_PERMISSION = 0o600
- def dump(database_name, output_file, pgsql_args)
+ # Triggers PgDump and outputs to the provided file path
+ #
+ # @param [String] output_file_path full path to the output destination
+ # @param [Gitlab::Backup::Cli::Utils::PgDump] pg_dump
+ # @return [Boolean] whether pg_dump finished with success
+ def dump(output_file_path, pg_dump)
compress_rd, compress_wr = IO.pipe
- compress_pid = spawn(gzip_cmd, in: compress_rd, out: [output_file, 'w', FILE_PERMISSION])
+
+ compress_pid = spawn(compress_cmd, in: compress_rd, out: [output_file_path, 'w', FILE_PERMISSION])
compress_rd.close
- dump_pid = Process.spawn('pg_dump', *pgsql_args, database_name, out: compress_wr)
+ dump_pid = pg_dump.spawn(output: compress_wr)
compress_wr.close
[compress_pid, dump_pid].all? do |pid|