backup 3.9.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/backup/cloud_io/s3.rb +1 -1
- data/lib/backup/database/redis.rb +9 -0
- data/lib/backup/model.rb +11 -7
- data/lib/backup/splitter.rb +17 -14
- data/lib/backup/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d08ea59b9238db092857f8ee08a10f1c695d1705
|
4
|
+
data.tar.gz: 8030b371b0b43a7ba075927af576265d5ddf8969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f76e9862b4784775aecd53127ebe9c478f378a7162348d88bd2fd5e0b515b144deb89dd89c68d7b4592f0f8d94eda4ac228bee29f204a240ab635038089ed27
|
7
|
+
data.tar.gz: 13c73bfd31689f46c9f0c809849e59180a1e4eebeb0af05650dae7a8948895f2dc5e80e08c6a67c16a5028fb6b58269be05f49f56d8fc3a7b6782730890a1e3c
|
data/lib/backup/cloud_io/s3.rb
CHANGED
@@ -106,7 +106,7 @@ module Backup
|
|
106
106
|
until keys.empty?
|
107
107
|
_keys = keys.slice!(0, 1000)
|
108
108
|
with_retries('DELETE Multiple Objects') do
|
109
|
-
resp = connection.delete_multiple_objects(bucket, _keys, opts)
|
109
|
+
resp = connection.delete_multiple_objects(bucket, _keys, opts.dup)
|
110
110
|
unless resp.body['DeleteResult'].empty?
|
111
111
|
errors = resp.body['DeleteResult'].map do |result|
|
112
112
|
error = result['Error']
|
data/lib/backup/model.rb
CHANGED
@@ -202,15 +202,19 @@ module Backup
|
|
202
202
|
end
|
203
203
|
|
204
204
|
##
|
205
|
-
# Adds a Splitter
|
206
|
-
#
|
207
|
-
|
208
|
-
|
209
|
-
|
205
|
+
# Adds a Splitter to split the final backup package into multiple files.
|
206
|
+
#
|
207
|
+
# +chunk_size+ is specified in MiB and must be given as an Integer.
|
208
|
+
# +suffix_length+ controls the number of characters used in the suffix
|
209
|
+
# (and the maximum number of chunks possible).
|
210
|
+
# ie. 1 (-a, -b), 2 (-aa, -ab), 3 (-aaa, -aab)
|
211
|
+
def split_into_chunks_of(chunk_size, suffix_length = 2)
|
212
|
+
if chunk_size.is_a?(Integer) && suffix_length.is_a?(Integer)
|
213
|
+
@splitter = Splitter.new(self, chunk_size, suffix_length)
|
210
214
|
else
|
211
215
|
raise Error, <<-EOS
|
212
|
-
Invalid
|
213
|
-
|
216
|
+
Invalid arguments for #split_into_chunks_of()
|
217
|
+
+chunk_size+ (and optional +suffix_length+) must be Integers.
|
214
218
|
EOS
|
215
219
|
end
|
216
220
|
end
|
data/lib/backup/splitter.rb
CHANGED
@@ -4,22 +4,25 @@ module Backup
|
|
4
4
|
class Splitter
|
5
5
|
include Backup::Utilities::Helpers
|
6
6
|
|
7
|
-
attr_reader :package, :chunk_size
|
7
|
+
attr_reader :package, :chunk_size, :suffix_length
|
8
8
|
|
9
|
-
def initialize(model, chunk_size)
|
9
|
+
def initialize(model, chunk_size, suffix_length)
|
10
10
|
@package = model.package
|
11
11
|
@chunk_size = chunk_size
|
12
|
+
@suffix_length = suffix_length
|
12
13
|
end
|
13
14
|
|
14
15
|
##
|
15
16
|
# This is called as part of the procedure used to build the final
|
16
17
|
# backup package file(s). It yields it's portion of the command line
|
17
18
|
# for this procedure, which will split the data being piped into it
|
18
|
-
# into multiple files, based on the @chunk_size
|
19
|
+
# into multiple files, based on the @chunk_size, using a suffix length as
|
20
|
+
# specified by @suffix_length.
|
19
21
|
# Once the packaging procedure is complete, it will return and
|
20
22
|
# @package.chunk_suffixes will be set based on the resulting files.
|
21
23
|
def split_with
|
22
|
-
Logger.info "Splitter configured with a chunk size of #{ chunk_size }MB
|
24
|
+
Logger.info "Splitter configured with a chunk size of #{ chunk_size }MB " +
|
25
|
+
"and suffix length of #{ suffix_length }."
|
23
26
|
yield split_command
|
24
27
|
after_packaging
|
25
28
|
end
|
@@ -28,12 +31,10 @@ module Backup
|
|
28
31
|
|
29
32
|
##
|
30
33
|
# The `split` command reads from $stdin and will store it's output in
|
31
|
-
# multiple files, based on
|
32
|
-
#
|
33
|
-
# final @package.basename, plus a '-' separator. This `prefix` will then
|
34
|
-
# be suffixed using 'aa', 'ab', and so on... for each file.
|
34
|
+
# multiple files, based on @chunk_size and @suffix_length, using the full
|
35
|
+
# path to the final @package.basename, plus a '-' separator as the `prefix`.
|
35
36
|
def split_command
|
36
|
-
"#{ utility(:split) } -b #{ chunk_size }m - " +
|
37
|
+
"#{ utility(:split) } -a #{ suffix_length } -b #{ chunk_size }m - " +
|
37
38
|
"'#{ File.join(Config.tmp_path, package.basename + '-') }'"
|
38
39
|
end
|
39
40
|
|
@@ -41,13 +42,15 @@ module Backup
|
|
41
42
|
# Finds the resulting files from the packaging procedure
|
42
43
|
# and stores an Array of suffixes used in @package.chunk_suffixes.
|
43
44
|
# If the @chunk_size was never reached and only one file
|
44
|
-
# was written, that file will be suffixed with '-aa'
|
45
|
-
# In which case, it will simply
|
45
|
+
# was written, that file will be suffixed with '-aa' (or -a; -aaa; etc
|
46
|
+
# depending upon suffix_length). In which case, it will simply
|
47
|
+
# remove the suffix from the filename.
|
46
48
|
def after_packaging
|
47
49
|
suffixes = chunk_suffixes
|
48
|
-
|
50
|
+
first_suffix = 'a' * suffix_length
|
51
|
+
if suffixes == [first_suffix]
|
49
52
|
FileUtils.mv(
|
50
|
-
File.join(Config.tmp_path, package.basename
|
53
|
+
File.join(Config.tmp_path, "#{ package.basename }-#{ first_suffix }"),
|
51
54
|
File.join(Config.tmp_path, package.basename)
|
52
55
|
)
|
53
56
|
else
|
@@ -57,7 +60,7 @@ module Backup
|
|
57
60
|
|
58
61
|
##
|
59
62
|
# Returns an array of suffixes for each chunk, in alphabetical order.
|
60
|
-
# For example: [aa, ab, ac, ad, ae]
|
63
|
+
# For example: [aa, ab, ac, ad, ae] or [aaa, aab, aac aad]
|
61
64
|
def chunk_suffixes
|
62
65
|
chunks.map {|chunk| File.extname(chunk).split('-').last }.sort
|
63
66
|
end
|
data/lib/backup/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael van Rooijen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -511,7 +511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
511
511
|
version: '0'
|
512
512
|
requirements: []
|
513
513
|
rubyforge_project:
|
514
|
-
rubygems_version: 2.1.
|
514
|
+
rubygems_version: 2.1.11
|
515
515
|
signing_key:
|
516
516
|
specification_version: 4
|
517
517
|
summary: Provides an elegant DSL in Ruby for performing backups on UNIX-like systems.
|