redsnapper 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +15 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/bin/redsnapper +15 -0
- data/lib/redsnapper.rb +42 -0
- data/redsnapper.gemspec +59 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aec33a2ff5db054d5bedbee9d13f85871de1309d
|
4
|
+
data.tar.gz: 40e112456f0e979b45a0fa5b11001582df5e23c8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0e80b0b25aca02166c0188f1a95af52b856ff0098a7b75a3a9ba32132e85e2c21098b7a7f598e5d6afc0f0b3d9521ff792baed1e59efbbf383ed31e3bbe4b3a4
|
7
|
+
data.tar.gz: 255779522651ea089a0e45aa8eb36f4a4f9c0f4f4e588fe0da53c54f41ee1d7ad299cc3608c3d37e7bd68c67b423cbd158754e0eb6915bd70189c8997099a4c8
|
data/.document
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Scott Wheeler
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
= redsnapper
|
2
|
+
|
3
|
+
Simple tool to run parallel tarsnap clients to do faster extractions of archives
|
4
|
+
with lots of files. Note, extraction will be slower on small archives since this
|
5
|
+
tool first has to build a list of files to extract. It then runs 25 clients in
|
6
|
+
parallel delivering approximately a 5x speedup in extracting large archives.
|
7
|
+
|
8
|
+
Usage: redsnapper archive [-d DIR] [-- [TARSNAP OPTIONS]]
|
9
|
+
-d, --directory DIR Extract files from this directory of the archive
|
10
|
+
|
11
|
+
== Copyright
|
12
|
+
|
13
|
+
Copyright (c) 2014 Scott Wheeler. See LICENSE.txt for
|
14
|
+
further details.
|
15
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "redsnapper"
|
18
|
+
gem.homepage = "http://github.com/directededge/redsnapper"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Faster extraction of large tarsnap archives}
|
21
|
+
gem.description = %Q{Faster extraction of large tarsnap archives using a pool of parallel tarsnap clients}
|
22
|
+
gem.email = "scott@directededge.com"
|
23
|
+
gem.authors = ["Scott Wheeler"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Code coverage detail"
|
36
|
+
task :simplecov do
|
37
|
+
ENV['COVERAGE'] = "true"
|
38
|
+
Rake::Task['test'].execute
|
39
|
+
end
|
40
|
+
|
41
|
+
task :default => :test
|
42
|
+
|
43
|
+
require 'rdoc/task'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "redsnapper #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/redsnapper
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require File.expand_path('../../lib/redsnapper', __FILE__)
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = 'Usage: redsnapper archive [-d DIR] [-- [TARSNAP OPTIONS]]'
|
10
|
+
opts.on('-d', '--directory DIR', 'Extract files from this directory of the archive') do |dir|
|
11
|
+
options[:directory] = dir
|
12
|
+
end
|
13
|
+
end.parse!
|
14
|
+
|
15
|
+
RedSnapper.new(ARGV.shift, options.merge(:tarsnap_options => ARGV)).run
|
data/lib/redsnapper.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'thread/pool'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
class RedSnapper
|
5
|
+
TARSNAP = 'tarsnap'
|
6
|
+
THREAD_POOL_SIZE = 25
|
7
|
+
MAX_FILES_PER_JOB = 50
|
8
|
+
|
9
|
+
def initialize(archive, options = {})
|
10
|
+
@archive = archive
|
11
|
+
@options = options
|
12
|
+
end
|
13
|
+
|
14
|
+
def file_groups
|
15
|
+
command = [ TARSNAP, '-tf', @archive, *@options[:tarsnap_options] ]
|
16
|
+
command.push(@options[:directory]) if @options[:directory]
|
17
|
+
|
18
|
+
files = IO.popen(command) do |io|
|
19
|
+
io.gets(nil).split.reject { |f| f.end_with?('/') }
|
20
|
+
end
|
21
|
+
|
22
|
+
files.each_slice([ (files.size.to_f / THREAD_POOL_SIZE).ceil, MAX_FILES_PER_JOB].min).to_a
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
pool = Thread.pool(THREAD_POOL_SIZE)
|
27
|
+
mutex = Mutex.new
|
28
|
+
|
29
|
+
file_groups.each do |chunk|
|
30
|
+
pool.process do
|
31
|
+
command = [ TARSNAP, '-xvf', @archive, *@options[:tarsnap_options], *chunk ]
|
32
|
+
Open3.popen3(*command) do |_, _, err|
|
33
|
+
while line = err.gets
|
34
|
+
mutex.synchronize { warn line }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
pool.shutdown
|
41
|
+
end
|
42
|
+
end
|
data/redsnapper.gemspec
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: redsnapper 0.1.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "redsnapper"
|
9
|
+
s.version = "0.1.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Scott Wheeler"]
|
14
|
+
s.date = "2014-03-07"
|
15
|
+
s.description = "Faster extraction of large tarsnap archives using a pool of parallel tarsnap clients"
|
16
|
+
s.email = "scott@directededge.com"
|
17
|
+
s.executables = ["redsnapper"]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE.txt",
|
20
|
+
"README.rdoc"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".document",
|
24
|
+
"Gemfile",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"bin/redsnapper",
|
30
|
+
"lib/redsnapper.rb",
|
31
|
+
"redsnapper.gemspec"
|
32
|
+
]
|
33
|
+
s.homepage = "http://github.com/directededge/redsnapper"
|
34
|
+
s.licenses = ["MIT"]
|
35
|
+
s.rubygems_version = "2.2.0"
|
36
|
+
s.summary = "Faster extraction of large tarsnap archives"
|
37
|
+
|
38
|
+
if s.respond_to? :specification_version then
|
39
|
+
s.specification_version = 4
|
40
|
+
|
41
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
+
s.add_runtime_dependency(%q<thread>, ["~> 0"])
|
43
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
44
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
45
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<thread>, ["~> 0"])
|
48
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
49
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
50
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
51
|
+
end
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<thread>, ["~> 0"])
|
54
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
55
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
56
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redsnapper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scott Wheeler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thread
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jeweler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
description: Faster extraction of large tarsnap archives using a pool of parallel
|
70
|
+
tarsnap clients
|
71
|
+
email: scott@directededge.com
|
72
|
+
executables:
|
73
|
+
- redsnapper
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files:
|
76
|
+
- LICENSE.txt
|
77
|
+
- README.rdoc
|
78
|
+
files:
|
79
|
+
- .document
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.rdoc
|
83
|
+
- Rakefile
|
84
|
+
- VERSION
|
85
|
+
- bin/redsnapper
|
86
|
+
- lib/redsnapper.rb
|
87
|
+
- redsnapper.gemspec
|
88
|
+
homepage: http://github.com/directededge/redsnapper
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.2.0
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Faster extraction of large tarsnap archives
|
112
|
+
test_files: []
|